[R-sig-Geo] Problem with Sweave and spplot

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Sep 2 19:26:48 CEST 2009


On Wed, Sep 2, 2009 at 8:26 AM, Barry
Rowlingson<b.rowlingson at lancaster.ac.uk> wrote:

>  I haven't tried this in an Sweave doc yet, but wouldn't it be neater
> to redefine spplot(...) to call print(spplot(...))?

 Well, I have now tested it in an Sweave doc, and this works and lets
you do plain spplot(...) in code sections. Whether there's any other
side effects I don't know... Here you go:

<<echo=FALSE, results=hide>>=
library(sp)
spplot.orig = spplot
spplot = function(...){print(spplot.orig(...))}
@

<<fig=TRUE>>=>
data(meuse)
coordinates(meuse)=cbind(meuse$x,meuse$y)
spplot(meuse,"dist")
@



More information about the R-sig-Geo mailing list