R CMD Sweave myfile.rnw的编织形式是什么? [英] What is the knitr equivalent of `R CMD Sweave myfile.rnw`?
本文介绍了R CMD Sweave myfile.rnw的编织形式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
相当于R CMD Sweave myfile.rnw
的命令行 knitr 是什么?
What is the command-line knitr equivalent of R CMD Sweave myfile.rnw
?
推荐答案
常规解决方案(无论R版本如何,都可以使用):
The general solution (works regardless of the R version):
Rscript -e "library(knitr); knit('myfile.Rmd')"
从R 3.1.0版本开始,R CMD Sweave
开始支持非Sweave文档(尽管命令名称听起来有些奇怪),您唯一需要做的就是在文档中指定一个装饰插图引擎,例如
Since R 3.1.0, R CMD Sweave
has started to support non-Sweave documents (although the command name sounds a little odd), and the only thing you need to do is to specify a vignette engine in your document, e.g.
%\VignetteEngine{knitr::knitr}
要查看针织衫中可能的装饰图案引擎,请使用
To see the possible vignette engines in knitr, use
library(knitr)
library(tools)
names(vignetteEngine(package = 'knitr'))
# "knitr::rmarkdown" "knitr::knitr" "knitr::docco_classic" "knitr::docco_linear"
这篇关于R CMD Sweave myfile.rnw的编织形式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文