Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Sweave "not run" option

Tags:

r

latex

sweave

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.

like image 702
user1981275 Avatar asked Oct 16 '25 19:10

user1981275


1 Answers

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)
@
like image 135
juba Avatar answered Oct 18 '25 09:10

juba