[R] trouble with \SweaveOpts{grdevice=...}

Liviu Andronic landronimirc at gmail.com
Thu Apr 14 18:29:20 CEST 2011


Dear all
I've just tried the brand new 'grdevice' option in Sweave but couldn't
make it work. When I declare
\SweaveOpts{grdevice=pdf}

or
\SweaveOpts{grdevice=cairo_pdf}

trying to plot something simple
<<fig=T, echo=T>>=
plot(1:10,1:10,main='Some title')
@

would result in an Sweave error:
18:16:47.299:  1 : term verbatim
18:16:47.308:  2 : echo term verbatim pdf pdf
18:16:47.391: Error in dev(name = chunkprefix, width = options$width,
height = options$height,  :
18:16:47.392:   unused argument(s) (name = chunkprefix)
18:16:47.393: Calls: Sweave -> <Anonymous> -> dev
18:16:47.396: Execution halted
Systemcall.cpp(238): Systemcall: 'Rscript --verbose --no-save
--no-restore "/usr/local/share/lyx-svn/scripts/lyxsweave.R"
"/tmp/lyx_tmpdir.J15281/lyx_tmpbuf5/""newfile2.Rnw"
"/tmp/lyx_tmpdir.J15281/lyx_tmpbuf5/""newfile2.tex" ISO-8859-15
"/tmp/"' finished with exit code 1
Error: Cannot convert file
----------------------------------------
An error occurred while running:
Rscript --verbose --no-save --no-restore
"/usr/local/share/lyx-svn/scripts/lyxsweave.R"
"/tmp/lyx_tmpdir.J15281/lyx_tmpbuf5/""newfile2.Rnw"
"/tmp/lyx_tmpdir.J15281/lyx_tmpbuf5/""newfile2.tex" ISO-8859-15 "/tmp/"
18:16:47.978: Error while previewing format: pdf2


If I comment out the statement
%\SweaveOpts{grdevice=pdf}

the compilation proceeds as expected. Hoping that it gets through, I'm
attaching the Sweave file. Am I doing something wrong?

Regards
Liviu


> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail


More information about the R-help mailing list