Define bordres in geoR using a shape file??
On Wed, 12 Dec 2007, Luca Moiana wrote:
Hello everyone, I?m moving to R to do gesostatistics and today?s problem is: I have a shp file of the region I?m considering and I want to define the value ?borders=? in the expression as.geodata. I imported the shapefile using maptools and I now have a spatial object, I think I have to convert the spatial object in a 2 columns matrix but I have no clue.
Please quote a short extract of your commands, and show what sessionInfo() says, both help. My reading of the code suggests that if the class of your polygons object is "SpatialPolygons", you can pass this through borders=, and the internal point-in-polygon function will find which locations= points fall inside the polygons. The borders= argument can also be a matrix, but it is turned into a SpatialPolygons object internally. Use as(<>, "SpatialPolygons") to coerce to SpatialPolygons. An alternative is to overlay() your input locations (SpatialGrid object) with the SpatialPolygons object to make a SpatialPixels object, then take coordinates() of that object and pass them through locations=. Roger
Any help is greatly welcome!! Luca
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no