Skip to content
Prev 5018 / 29559 Next

SpatialGridDataFrame to data.frame

Roger and Robert,

Thanks for the help. Once again I am close but I can't figure out how to 
use the attribute data to control the sampling. I'd like to stratify the 
sampling by attribute value. In the Shapefile I have an integer 
attribute "covertype". There can be several polygons with the same 
covertype ID. What I want to do is get 100 sample points from polygons 
of covertype=1, 100 points from polygons of covertype=2... Is that 
possible? I looked at readShapePoly, readORG, and the suite of tools in 
spsample and but didn't see what I was looking for.

It looks like overlay() is a good way to assign the value of covertype 
to coordinate pairs.

One solution to fix all of this is to have a separate Shapefile for each 
covertype but I'd like to avoid that if possible.

Ned
Roger Bivand wrote: