[R] [R-pkgs] gstat 0.9-12: cokriging cross validation and class name incompatibilities

Edzer J. Pebesma e.pebesma at geog.uu.nl
Wed Jun 16 09:48:34 CEST 2004

I uploaded gstat 0.9-12 to CRAN, which has a few important changes:

1. Cokriging cross validation

Cokriging cross validation is now possible with the function gstat.cv:
you simply pass a multivariable gstat object, and cross validation is done
for the first variable in the object. Optionally, secondary variable 
at locations coinciding with the validation locations are removed.

2. Class name changes

Both gstat and geoR used the name "variogram" for -- highly incompatible --
objects that contain information about a variogram. This led to errors when
calling plot() with a variogram object calculated from one, but plotted by
the other package. I changed the class name into "gstatVariogram". The full
list of class name changes:

variogram -> gstatVariogram
point.pairs -> pointPairs
variogram.map -> variogramMap
variogram.cloud -> variogramCloud

You can still run scripts you have with the new packages, but e.g. plot(v)
when v is an old object of class "variogram" will not work with the new
package. As these are S3 classes, a simple solution would be to
reassign the class:

class(v) = c("gstatVariogram", "data.frame")

3. Compatibility with package sp and variogram maps
On http://sourceforge.net/projects/r-spatial/ beta releases for the upcoming
package sp are available; sp provides classes and methods for spatial data.
Instead of:

 > library(gstat)
 > data(meuse)
 > variogram(zinc~1, ~x+y, meuse)

you could, with package sp loaded, do:

 > coordinates(meuse) = ~x+y # promotes meuse to SpatialDataFrame
 > variogram(zinc~1, meuse) # no coordinates required.

In addition, sp provides classes for gridded data and polygon data. With sp
loaded, gstat can calculate variogram maps.

Any comments are welcome,

R-packages mailing list
R-packages at stat.math.ethz.ch

More information about the R-help mailing list