
size
cells from each stratum. The values in the RasterLayer x
are rounded to integers; with each value representing a stratum.## S3 method for class 'RasterLayer':
sampleStratified(x, size, exp=10, na.rm=TRUE, xy=FALSE, ext=NULL, sp=FALSE, ...)
TRUE
(the default), NA
values are removed from random sampleTRUE
, a SpatialPointsDataFrame is returnedsampleRandom, sampleRegular
r <- raster(ncol=10, nrow=10)
names(r) <- 'stratum'
r[] <- round((runif(ncell(r))+0.5)*3)
sampleStratified(r, size=3)
Run the code above in your browser using DataLab