From murdoch.duncan at gmail.com  Thu Aug 19 21:07:15 2010
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Thu, 19 Aug 2010 15:07:15 -0400
Subject: [Rd] Does anyone use Sweave (RweaveLatex) option "expand=FALSE"?
Message-ID: <4C6D80E3.2090806@gmail.com>

I am trying to improve the error reporting in Sweave documents, so that 
if you have a syntax error in a code chunk, it will tell you which line 
of your input file contained the error.

For example, currently you get this:

Error:  chunk 1 (label=named)
Error in parse(text = chunk) : unexpected symbol in "x <- foo bar"
Execution halted

and I'd like errors to be more like this:

Error:  chunk 1 (label=named)
Error in parse(text = chunk, srcfile = srcfile) :
  test.Rnw:9:10: unexpected symbol
9: x <- foo bar
            ^
Execution halted

It turns out that this requires changes that make the "expand=FALSE" 
option quite hard to implement.  Is anyone using it?  For those who 
don't know it, "expand=FALSE" means that a code chunk like

<<echo=TRUE, keep.source=TRUE,expand=FALSE>>=
z <- 3
<<named>>
@

will be displayed as

 > z <- 3
 > <<named>>

rather than expanding the named chunk.  I'd like to drop the option, so 
that the default behaviour (which has always been equivalent to "expand 
= TRUE") would be the only behaviour.

Duncan Murdoch



[Rd] Does anyone use Sweave (RweaveLatex) option "expand=FALSE"?
Duncan Murdoch