[R] \Sweaveopts error

John Maindonald john.maindonald at anu.edu.au
Thu Nov 25 12:34:10 CET 2010


I have a file 4lmetc.Rnw, intended for inclusion in a LaTeX document,
that starts:

\SweaveOpts{engine=R, keep.source=TRUE}
\SweaveOpts{eps=FALSE, prefix.string=snArt/4lmetc}

The attempt to process the file through Sweave generates the error:

> Sweave("4lmetc")
Writing to file 4lmetc.tex
Processing code chunks ...
 1 : keep.source term verbatim
Error in file(srcfile$filename, open = "rt", encoding = encoding) : 
  cannot open the connection
In addition: Warning message:
In file(srcfile$filename, open = "rt", encoding = encoding) :
  cannot open file '4lmetc': No such file or directory

The same file processes through Stangle() without problems.
If I comment out the \Sweaveopts lines, there is no problem,
except that I do not get the options that I want.

This processed fine in R-2.11.1

> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  grid      methods  
[8] base     

other attached packages:
[1] lattice_0.19-13     DAAG_1.02           randomForest_4.5-36
[4] rpart_3.1-46        MASS_7.3-8          reshape_0.8.3      
[7] plyr_1.2.1          proto_0.3-8        

loaded via a namespace (and not attached):
[1] ggplot2_0.8.8       latticeExtra_0.6-14

Is there a workaround?

John Maindonald             email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473    fax  : +61 2(6125)5549
Centre for Mathematics & Its Applications, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
http://www.maths.anu.edu.au/~johnm



More information about the R-help mailing list