我想要对rnw文件中的代码块使用conditional eval。
当我运行官方示例时:knitr examples/011-conditional-eval.Rnw
\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}
<<controller>>=
# this variable controls if a chunk should be evaluated
dothis <- TRUE
@
<<chunk1, eval = dothis>>=
print('say hello world')
@
<<chunk2, eval = !dothis>>=
print('silence is gold')
@
\end{document}我得到以下错误:
Writing to file test.tex
Processing code chunks with options ...
1 : echo keep.source term verbatim (label = controller, test.Rnw:6)
Error in check(options) : invalid value for 'eval' : dothis
Calls: <Anonymous> -> SweaveParseOptions -> check
Execution halted我做错了什么?我正在使用Rstudio运行rnw文件
发布于 2016-05-27 19:01:06
你看起来是在运行Sweave,而不是knitr。在RStudio中检查您的全局或项目选项,看看它选择了哪一个。
https://stackoverflow.com/questions/37472619
复制相似问题