[R] kriging shapefiles

Michael Sumner mdsumner at gmail.com
Thu Oct 6 02:36:56 CEST 2011


It is perhaps easier than you think, see the example in gstat:

library(gstat)
?krige

After this is run "meuse" is a SpatialPointsDataFrame:

coordinates(meuse) = ~x+y

Any point shapefile read with readOGR from rgdal (or the alternative
functions in maptools) will also be SpatialPointsDataFrames, and so
the code will work much the same.

To use other kriging functions that perhaps use data.frames, just use
as.data.frame(x) to convert a SpatialPointDataFrame to the non-spatial
version.

Cheers, Mike.


On Wed, Oct 5, 2011 at 8:07 PM, Leynnard Rey Matillano
<silverstein_yellowcard at yahoo.com> wrote:
> Hi! Im new to R and I need to interpolate a shapefile using kriging. I've been able to plot/read the shapefile using the package maptools or rgdal. I've searched the internet for sample codes but most of the kriging codes that I've found done in R is done using txtfiles or CSVs.  An example could be of great help. Thanks.
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-help mailing list