[Rd] Sweave processes \Sexpr in commented LaTeX source

Seth Falcon sfalcon at fhcrc.org
Thu Sep 21 16:43:16 CEST 2006

[shameless plug]

Jean lobry <lobry at biomserv.univ-lyon1.fr> writes:
> <<TimeConsumingCodeChunk1,eval=F>>=
> x <- rnorm(100)
> ...
> @
> I have \Sexpr{ifelse(exists("x"), length(x), "Ooops, I forgot
> to evaluate TimeConsumingCodeChunk1")} elements in vector x.

For the case of TimeConsumingCodeChunks, another solution is the
weaver package that caches the results of such chunks.  So you could

<<TimeConsumingCodeChunk1, cache=TRUE>>=
x <- rnorm(100)

Then as long as the dependencies of the expressions in
TimeConsumingCodeChunk1 don't change, it won't be recomputed.


+ seth

More information about the R-devel mailing list