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]]
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
On 10/05/2011 09:07 AM, Leynnard Rey Matillano 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@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....you could also take a look at the automap package (some blatant self promotion ;)). This builds on gstat... Paul -- Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770 [[alternative HTML version deleted]]