You are correct that the input data for krige should be points, not 
polygons. The prediction locations could be polygons though. In the 
example you use

krige(formula = log(variable)~1, data, data.grid, model = m)

data (please use another name, data is also a function in R) should be a 
SpatialPointsDataFrame or SpatialPixelsDataFrame of observations. 
data.grid can be any spatial object for which you would like 
predictions. In demo(krige), data is the 155 observations of metal 
concentrations close to the river Meuse, whereas meuse.grid is a grid 
with a fairly high resolution for which you want to predict.
I do not know how to to from a polygon shapefile to a points shapefile, 
but you can go from SpatialPolygonsDataFrame to SpatialPointsDataFrame 
in R by:
sp1 = SpatialPointsDataFrame(coordinates(sp0), data = sp0@data)
if sp0 is your SpatialPolygonsDataFrame.

Whether this is sensible depends on your data. Not all polygon data can 
be interpolated as points without loss of information. You could have a 
look at the rtop package from R-forge if you want a kriging method that 
can interpolate between polygons.
 > **|install.packages("rtop", repos= c("http://R-Forge.R-project.org")|**

Jon

On 13-Jul-12 2:00, riaarinda wrote:
> I think to do krige(), the shapefile must be points, not polygons. I try to
> put my shapefile into mapwindow to krige but it didn't work. But after I
> convert it into points shapefile through GeoDa and then put it into
> mapwindow again, it can do kriging function in mapWindow.
> Now I'm confused how to do krige in R. My poly shapefile contains numbers of
> districts. In R, to krige we use krige(formula = log(variable)~1, data,
> data.grid, model = m). I already have data as I have example.shp, but I
> still don't get it what I should put as data.grid. What is data.grid? And if
> you don't mind, could you tell me how to convert a polygons shapefile into
> points shapefile?
> Thanks a lot.
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Data-grid-in-kriging-tp7580428p7580458.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-- 
Jon Olav Skøien
Joint Research Centre - European Commission
Institute for Environment and Sustainability (IES)
Land Resource Management Unit

Via Fermi 2749, TP 440,  I-21027 Ispra (VA), ITALY

jon.skoien@jrc.ec.europa.eu
Tel:  +39 0332 789206

Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.



	[[alternative HTML version deleted]]

