Simon Jackman
2010-Sep-11 16:42 UTC
[Rd] Sweave issue; keep.source=TRUE and cacheSweave incompatible?
This could well be a package-specific issue, and so perhaps not for R-devel. The author of the relevant package is CC'd in any event. I'm seeing some odd behavior from Sweave with keep.source=TRUE when using driver=cacheSweaveDriver from the cacheSweave package. It would seem that code chunks with keep.source=TRUE aren't being parsed correctly; the corresponding Schunk starts at the *very top* of the Rnw file, snippet shown below. The error seems specific to R 2.12.0; cacheSweave + keep.source=TRUE seems to work ok in R 2.11. Many thanks — Simon Version details: R version 2.12.0 Under development (unstable) (2010-09-10 r52888) cacheSweave package 0.4-4 Sweave invocation and output:> Sweave("test.Rnw",driver="cacheSweaveDriver")Writing to file test.tex Processing code chunks ... 1 : term hide (label=setCache) 2 : echo term verbatim (label=rnorm) 3 : echo keep.source term verbatim (label=runif) 4 : echo term verbatim (label=summary) You can now run LaTeX on 'test.tex' Bad Schunk: \begin{Schunk} \begin{Sinput}> \documentclass{article} > > \usepackage[noae]{Sweave} > > \begin{document} > \SweaveOpts{prefix.string=foo,png=FALSE,echo=TRUE,eps=FALSE} > @ > <<setCache,echo=FALSE,results=hide>>> library(cacheSweave) > setCacheDir("./cache") > @ %def > > This is a test. > > @ > <<rnorm,cache=TRUE>>> summary(rnorm(n=100)) > @ %def > > This is another test. > > @ > <<runif,cache=TRUE,keep.source=TRUE>>> z <- runif(n=100)\end{Sinput} \end{Schunk} Simon Jackman, Depts of Political Science & (by courtesy) Statistics, Stanford University, Stanford, CA 94305-6044, USA. http://jackman.stanford.edu Co-Principal Investigator, American National Election Studies cell: +1 (650) 387 3019 fax: +1 (650) 724-9095 [[alternative HTML version deleted]]