[R] Sweave: centering with echo=TRUE
David.Epstein
David.Epstein at warwick.ac.uk
Mon Apr 26 13:07:39 CEST 2010
In a .Rnw file I want to insert the R command
pairs(mydataframe)
and achieve the following effects
1. the command itseld is echoed into the tex document generated by Sweave
<<fig=TRUE,echo=TRUE>>=
2. The graphics generated appears in the tex document, with the graphics
centred.
3. The R command > pairs(mydataframe) is not centered.
Sweave-manual.pdf gives the following code chunk
<<results=tex,echo=FALSE>>=
for(i in 1:4){
file=paste("myfile", i, ".eps", sep="")
postscript(file=file, paper="special", width=6, height=6)
plot(rnorm(100)+i)
dev.off()
cat("\\includegraphics{", file, "}\n\n", sep="")
}
@
This could obviously be adapted to my centering problem, but is it the
simplest way? It seems complicated compared with just pairs(mydataframe).
Also, Sweave will normally make both postscript and pdf plots, but this
would involve further complication in the code. I'm sure it's completely
standard to produce two copies of graphics, one a pdf and one an eps, but
it's another obstacle in my way when I want to get on with writing the
program and its latex description.
Thanks
David
--
View this message in context: http://r.789695.n4.nabble.com/Sweave-centering-with-echo-TRUE-tp2065018p2065018.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list