trouble with \SweaveOpts{grdevice=...}
On 11-04-14 12:29 PM, Liviu Andronic wrote:
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?
Yes, you need to use a function with arguments as listed in the ?RweaveLatex help page. It should have arg list (name, width, height, ...). The pdf() function does not. Duncan Murdoch
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
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.