Peter Pfand
Peter Pfand

Reputation: 185

knitr::spin does not set global chunk options from the command line

When I generate my .md and .html files with the following code using knitr::spin instead of knitr:knit on the command line, it completely ignores the global chunk options:

Rscript -e "require(knitr)" -e "knitr::spin('script.R')" \
        -e knitr::opts_chunk[['set']](include=FALSE)"

Could you tell me please how to set global options from the command line with spin?

Upvotes: 0

Views: 114

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30114

Set the global chunk options before you spin() the R script, e.g.

Rscript -e "library(knitr)" -e "knitr::opts_chunk[['set']](include=FALSE)" \
  -e "knitr::spin('script.R')"

Upvotes: 2

Related Questions