R Sweave"不跑"选项

use*_*275 3 latex r sweave

我在R中使用Sweave来制作包装插图,并想知道是否有办法在Sweave标签中"不运行"某些代码,例如:

\documentclass{article}
\usepackage{Sweave}

\begin{document}

<<a>>=
source("http://bioconductor.org/biocLite.R")
biocLite("Rgraphviz",depend=TRUE)
@

<<<b>>=
x <- 1
cat(x, "\n")
@ 

\end{document}
Run Code Online (Sandbox Code Playgroud)

Sweave中有一个选项可以不在<<a>>=标记中运行代码 吗?(我可以简单地使用"逐字"而不是Sweave标签,但是对于Rd文件有什么类似"不运行"的东西?)我查看了Sweave用户手册中的选项,但没有找到我要找的内容.

jub*_*uba 9

您可以eval在代码块上使用该选项.就像是 :

<<a, eval=FALSE, echo=TRUE>>=
source("http://bioconductor.org/biocLite.R")
biocLite("Rgraphviz",depend=TRUE)
@
Run Code Online (Sandbox Code Playgroud)