From: Prof Brian Ripley (ripley@stats.ox.ac.uk)
Date: Tue 30 Dec 2003 - 19:37:18 EST
Message-id: <Pine.LNX.4.44.0312300832070.10660-100000@gannet.stats>
On Tue, 30 Dec 2003, v.demart@libero.it wrote:
> I'm reading Ripley-Venables "Modern Applied Statistics with S - Fourth edition" , at the same time trying the examples proposed in the book using R 1.8.1 under linux.
>
> Now I'm trying the following code from the book (example code of spatial statistics at page 76) with R :
>
> | data(topo) library("spatial") topo.loess<-loess(z ~ x * y, topo,
> | degree= 2,span=0.25)
> | topo.mar<-list(x=seq(0,6.5,0.2),y=seq(0,6.5,0.2))
> | topo.lo=predict(topo.loess,expand.grid(topo.mar))
It does not say that!
> | par(pty="s")
> | contour(topo.mar$x,topo.mar$y,topo.lo,xlab="",ylab="",levels=seq(700,1000,25),cex=0.7)
>
> and at the "contour" command the following error pops up:
>
> Error in contour.default(topo.mar$x, topo.mar$y, topo.lo, xlab = "",
> ylab = "", :
> ~ no proper `z' matrix specified
>
> Being an R newbye I don't know what to do next to fix the problem.
Look in the R scripts provided to see the R version of the code.
.../library/MASS/scripts/ch04.R contains
topo.loess <- loess(z ~ x * y, topo, degree = 2, span = 0.25)
topo.mar <- list(x = seq(0, 6.5, 0.2), y=seq(0, 6.5, 0.2))
topo.lo <- predict(topo.loess, expand.grid(topo.mar))
topo.lo <- matrix(topo.lo, length(topo.mar$x),length(topo.mar$y))
par(pty = "s") # square plot
contour(topo.mar$x, topo.mar$y, topo.lo, xlab = "", ylab = "",
levels = seq(700,1000,25), cex = 0.7)
R's contour is not quite the same as the S original.
-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
This archive was generated by hypermail 2.1.3 : Thu 01 Jan 2004 - 09:21:04 EST