[R-pkgs] new gstat version
Edzer J. Pebesma
e.pebesma at geog.uu.nl
Tue Jan 10 13:36:20 CET 2006
Soon on CRAN a new version of package gstat will emerge, which
has a few minor changes and possible incompatibilities w.r.t. the
previous version(s).
The new gstat (0.9-23) now:
+ depends on sp, and uses internally with Spatial* classes from sp
if data are provided in the old-fashoned way (as data.frame)
+ has a vignette to get you started with the classes in sp
+ defines krige as a generic; two typical uses are:
# "old-style", using data.frame's:
library(gstat)
data(meuse)
data(meuse.grid)
v = vgm(0.6, "Sph", 900, 0.1) # spherical variogram model
zn.kri1 = krige(log(zinc)~1, ~x+y, meuse, meuse.grid, v)
image(zn.kri1)
# "new-style", using SpatialPointsDataFrame's:
coordinates(meuse) = c("x", "y") # promote meuse to SpatialPointsDataFrame
coordinates(meuse.grid) = c("x", "y") # promote to SpatialPointsDataFrame
gridded(meuse.grid) = TRUE # promote to SpatialPixelsDataFrame
zn.kri2 = krige(log(zinc)~1, meuse, meuse.grid, v)
spplot(zn.kri2[1])
+ provides a generic idw for inverse distance interpolation
(calling sequence identical to krige)
INCOMPATIBLE CHANGE:
the krige generic is
krige(formula, locations, ...)
based on the class of argument 2 (locations) either of the two
versions (see above) is called. This means that no named argument
"data" should be passed in case locations is missing (i.e., when
data is of class SpatialPointsDataFrame). Instead, pass it as
argument 2 or as named argument "locations".
--
Edzer
More information about the R-packages
mailing list