@andrewheiss 整洁#rstats tidyverse技巧:使用magrittr的tee操作符(%T>%)将pandoc表输出到文档中(如在Rmd块中)并将表保存到文件中,而无需创建中间对象
library(tidyverse)
library(pander)
mtcars %>%
group_by(cyl, gear) %>%
summarize(avg_mpg = mean(mpg), avg_hp = mean(hp)) %T>% # tee operator
pandoc.table() %>% # Print the output
pandoc.table.return() %>% # Save the output
cat(file = "output.md")
网友评论