From sfalcon at fhcrc.org  Thu Sep 21 16:43:16 2006
From: sfalcon at fhcrc.org (Seth Falcon)
Date: Thu, 21 Sep 2006 07:43:16 -0700
Subject: [Rd] Sweave processes \Sexpr in commented LaTeX source
In-Reply-To: <p0600200ac138480b0ace@[134.214.34.142]> (Jean lobry's message of
	"Thu, 21 Sep 2006 16:08:12 +0200")
References: <mailman.7.1158832802.27275.r-devel@r-project.org>
	<p0600200ac138480b0ace@[134.214.34.142]>
Message-ID: <m2hcz1qnzv.fsf@ziti.local>

[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
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




[Rd] Sweave processes \Sexpr in commented LaTeX source
Seth Falcon