Question

I use Sweave in R to make a package vignette and would like to know if there is a way to "not run" certain code within a Sweave tag, for example:

\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}

Is there an option in Sweave to not run the code in the <<a>>= tag? (I could simply use "verbatim" instead of a Sweave tag, but is there something like a "not run" as for Rd files?) I looked into the options in the Sweave User Manual, but did not find what I am looking for.

Was it helpful?

Solution

You can use the eval option on your code chunk. Something like :

<<a, eval=FALSE, echo=TRUE>>=
source("http://bioconductor.org/biocLite.R")
biocLite("Rgraphviz",depend=TRUE)
@
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top