[R-sig-Geo] krige problem: IDW + irregular blocks
Mauricio Zambrano
hzambran.newsgroups at gmail.com
Thu Feb 5 20:12:37 CET 2009
Dear List,
I need to carry out an IDW interpolation of precipitation values
within a basin. I want to obtain the mean value in each one of the
subcatchments, which are defined as polygons in a shapefile.
I would like to know:
How can I transform the subcatchments polygons (class
"SpatialPolygonsDataFrame" ) into a "data.frame" that can be used by
the "block" parameter of the "krige" function ?
So far, I've tried:
1) SubCatchments.shp <- readShapePoly(SubCatchmentsShp.fname, proj4string=p4s)
2) centroids <- coordinates(SubCatchments.shp)
3) pp.idw.block <- krige(value~1, locations=centroids, block=SubCatchments.shp)
Steps 1 and 2 are ok, but in step 3 I get the error:
Error en function (classes, fdef, mtable) :
unable to find an inherited method for function "krige", for
signature "formula", "matrix"
because "SubCatchments.shp" class is "SpatialPolygonsDataFrame' and
not 'data.frame'
Any help will be appreciated.
Thanks in advance,
Mauricio
--
=============================================
Linux user #454569 -- Ubuntu user #17469
=============================================
"A journey of a thousand miles
begins with a single step"
(Lao Tse)
More information about the R-sig-Geo
mailing list