Re: [Rd] Sweave processes \Sexpr in commented LaTeX source

From: Seth Falcon <>
Date: Thu 21 Sep 2006 - 14:43:16 GMT

[shameless plug]

Jean lobry <> 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 have:

<<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 mailing list Received on Fri Sep 22 00:53:52 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 21 Sep 2006 - 15:30:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.