Hi
I am sorry, my question seems simple and must already have been asked,
but I did not find any aswser on the archives :-(
I am trying to use a plot in Sweave, where I include myself the statement
<<results=tex,echo=FALSE>>=
pdf("plot.pdf")
plot(runif(100))
dev.off()
cat("\\includegraphics{plot}\n\n")
@
as is documented in the Sweave user guide A.9. The problem is that a
"null device 0" is printed in my document! Indeed, each time one opens
pdf() or any device, some mention "pdf" inevitably shows up... try:
pdf()
plot(runif())
dev.off()
How can one get rid of this? The only workaround I found is to place it
into a if() loop:
for(i in 1:1){
pdf()
plot(runif())
dev.off()
}
so there is no track of the mention null device, and my sweave pdf looks
better. Any idea of a more elegant solution?
Thanks!!
______________________________________________
R-help@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.