[R-sig-Geo] stratified random sampling

rick reeves reeves at nceas.ucsb.edu
Mon Feb 23 20:31:31 CET 2009


Hi Gerald:

I have an example that may help: It demonstrates the sampling of a 
polygon shape file with a regularly-spaced point grid,
and assignment of polygon values to the sampling points:

http://nceas.ucsb.edu/scicomp/GISSeminar/UseCases/SampleVectorPolygonsRasterGrid/SampleVectorPolysRastGrid.html

You could modify this example to randomly select a point inside each 
polygon from the point grid (or a similar modification).

Hope this helps..
Rick Reeves

Heuvelink, Gerard wrote:
> 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
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   


-- 
Rick Reeves
Scientific Programmer/Analyst and Data Manager
National Center for Ecological Analysis and Synthesis
UC Santa Barbara
www.nceas.ucsb.edu
805 892 2533



More information about the R-sig-Geo mailing list