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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to