[R-sig-Geo] stratified random sampling

Heuvelink, Gerard Gerard.Heuvelink at wur.nl
Mon Feb 23 19:47:00 CET 2009


Dear list,
 
I use readShapePoly to import a shape file. The file has multiple polygons (actually, a 'polygon' may consist of multiple polygons that have the same ID). I want to sample one location at random from each of the polygons. I tried to do this with spsample but did not manage (the option "stratified" does not do what I want). I also looked at dotsInPolys but also without success.
 
I think it should be possible with spsample, possibly after first creating a large number of SpatialPolygons objects, one for each polygon, and next sampling one location at random from each of these. Unfortunately I am not very experienced and also failed to achieve what I want in this way.
 
Can you help me?
 
Thanks, Gerard Heuvelink



More information about the R-sig-Geo mailing list