什么是等效于RStudio的Knit HTML的简洁命令行? [英] What is a neat command line equivalent to RStudio's Knit HTML?
问题描述
什么是等效于RStudio的Knit HTML的简洁命令行?给定一个.Rmd
文件,您可以使用RStudio通过Knitr编织.html
,.docx
和.pdf
文件.最好将这个过程完全转移到命令行.到目前为止,我的方法:
What is a neat command line equivalent to RStudio's Knit HTML? Given an .Rmd
file, you can use RStudio to knit .html
, .docx
and .pdf
files using Knitr. It would be great to shift this process completely to the command line. My approach so far:
Rscript -e "library(knitr); knit('test.Rmd')" # This creates test.md
pandoc test.md >> test.html
这可以很好地工作,但是生成的test.html
与RStudio相比并没有漂亮的改头换面.任何建议如何最好地通过命令行将.Rmd
文件编织到.html
,并以漂亮的.html
结尾?
This works fine, but the resulting test.html
does not come with the same pretty make over as in RStudio. Any suggestions how one should best knit .Rmd
files to .html
via the command line, and end up with a pretty .html
?
额外的问题:对于.pdf
或.docx
,最佳的命令行解决方案是什么?
Extra question: What would be the best command line solution for .pdf
or .docx
?
推荐答案
rmarkdown::render("test.Rmd", "html_document")
这篇关于什么是等效于RStudio的Knit HTML的简洁命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!