knitrを使用してrnwファイルのコードブロックに条件付き評価を使用したいとします。knitrをrnwファイルで使用する方法conditional evalの使用方法
私は公式の例を実行します。knitr-例/ 011-条件付き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
は私が間違って何をしているのですか?私はrnwファイルを実行するためにRstudioを使用しています
TRUEはTRUEではありません – baptiste
TRUEはどちらでも動作しません:( – Robin