From lobry at biomserv.univ-lyon1.fr  Thu Sep 21 16:08:12 2006
From: lobry at biomserv.univ-lyon1.fr (Jean lobry)
Date: Thu, 21 Sep 2006 16:08:12 +0200
Subject: [Rd] Sweave processes \Sexpr in commented LaTeX source
In-Reply-To: <mailman.7.1158832802.27275.r-devel@r-project.org>
References: <mailman.7.1158832802.27275.r-devel@r-project.org>
Message-ID: <p0600200ac138480b0ace@[134.214.34.142]>

Marc,

>I have a large .Rnw file and was in the process of doing some debugging.
>I had set some R chunks to 'eval=false' in the process. This resulted in
>some R objects not being created that were in turn used in the
>subsequent \Sexpr's.

I have often the same problem, I'm using a construct like :

<<eval=F>>=
x <- rnorm(100)
@

I have \Sexpr{ifelse(exists("x"), length(x), "???")} elements
in vector x.

This works well for me, and you have more control than a global
\SweaveOpts{eval.Sexpr=false} would allow, for instance :

<<TimeConsumingCodeChunk1,eval=F>>=
x <- rnorm(100)
...
@

I have \Sexpr{ifelse(exists("x"), length(x), "Ooops, I forgot
to evaluate TimeConsumingCodeChunk1")} elements in vector x.

Wouldn't it be enough to mention this in Sweave's FAQ ?

Best,

Jean
-- 
Jean R. Lobry            (lobry at biomserv.univ-lyon1.fr)
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56     fax    : +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/




[Rd] Sweave processes \Sexpr in commented LaTeX source
Jean lobry