Skip to content

Selecting Random Polygons

2 messages · Robin Sleith, Edzer Pebesma

#
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: