Skip to content
Prev 257124 / 398506 Next

sweave options with variable

On 11-04-17 2:41 AM, Kai Ying wrote:
You can't do that, but you can get a similar effect this way:

<<echo=FALSE>>=
needRun <- TRUE
@

...

<<thecode,eval=FALSE>>=
someSlowFunction()
@

<<echo=FALSE>>=
if (needRun) {
<<thecode>>
}
@

Or you could use cacheSweave or weaver for caching, which may do what 
you want, or write your own Sweave driver to do exactly what you want.

Duncan Murdoch