From mschwartz at mn.rr.com  Thu Sep 21 18:15:13 2006
From: mschwartz at mn.rr.com (Marc Schwartz (via MN))
Date: Thu, 21 Sep 2006 11:15:13 -0500
Subject: [Rd] Sweave processes \Sexpr in commented LaTeX source
In-Reply-To: <p0600200ac138480b0ace@[134.214.34.142]>
References: <mailman.7.1158832802.27275.r-devel@r-project.org>
	<p0600200ac138480b0ace@[134.214.34.142]>
Message-ID: <1158855313.3888.69.camel@localhost.localdomain>

On Thu, 2006-09-21 at 16:08 +0200, Jean lobry wrote:
> 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 ?

Jean,

Thanks for your comments and approach. I will keep it in mind.

In my case, I had a large flow/org type chart that I created with
pstricks and there were quite a few Sexpr's in the chart code. All of
the Sexpr's were based upon common objects created in preceding R
chunks. I considered that it would be easier to simply treat it all as a
common block that could be commented.

Based upon Fritz' reply today, it seems that we will have an easier
solution coming.

Best regards,

Marc




[Rd] Sweave processes \Sexpr in commented LaTeX source
Marc Schwartz (via MN