Skip to content
Prev 20632 / 29559 Next

Selecting Random Polygons

require(sp)
# select 20 random polygons:
nysample = nylakes[sample(4466,20),]
plot(nysample)
# sample a single random point inside each polygon:
pts = do.call(rbind,
  lapply(nysample at polygons, spsample, n=1, type="random"))
plot(p, add=TRUE, col='red')

hth,
On 03/21/2014 02:30 PM, Robin Sleith wrote: