What is the command-line knitr equivalent of R CMD Sweave myfile.rnw
?
The general solution (works regardless of the R version):
Rscript -e "library(knitr); knit('myfile.Rmd')"
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With