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

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

[shameless plug]

Jean lobry <lobry@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 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.

Best,

+ seth



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel 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 https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.