Skip to content
Prev 234275 / 398500 Next

Sweave: infelicities with lattice graphics

Just a follow-up on this thread, now with R 2.11.1.  I was happy back 
then to use Deepayan's solution for this, under earlier R versions; but 
it now gives an error and the Sweave-generated .tex file no longer compiles.

<<ortho-xyplot1-code, keep.source=TRUE, eval=FALSE>>=
library(nlme)
library(lattice)
xyplot(distance ~ age|Sex, data=Orthodont, type='b', groups=Subject, 
pch=15:25,
     col=palette(), cex=1.3, main="Orthodont data")
@
<<ortho-xyplot1,fig=TRUE, include=FALSE, echo=FALSE, width=6, height=6>>=
plot(trellis.last.object())
@

Now, I get the following from Sweave:

Error:  chunk 46 (label=ortho-xyplot1)
Error in !lattice.getStatus("current.plot.saved", prefix = prefix) :
   invalid argument type

Did something in lattice change so that plot(trellis.last.object()) no 
longer works or needs to be specified differently?

-Michael
On 7/16/2010 1:14 AM, Deepayan Sarkar wrote: