sampleStratified.Rd
Take a stratified random sample from the cell values of a Raster* object (without replacement). An attempt is made to sample size
cells from each stratum. The values in the RasterLayer x
are rounded to integers; with each value representing a stratum.
# S4 method for class 'RasterLayer'
sampleStratified(x, size, exp=10, na.rm=TRUE, xy=FALSE, ext=NULL, sp=FALSE, ...)
Raster* object, with values (rounded to integers) representing strata
positive integer giving the number of items to choose
numeric >= 1. 'Expansion factor' that is multiplied with size to get an intial sample. Can be increased when you get an insufficient number of samples for small strata
logical. If TRUE
(the default), NA
values are removed from random sample
logical. Return coordinates of cells rather than cell numbers
Extent object. To limit regular sampling to the area within the extent
logical. If TRUE
, a SpatialPointsDataFrame is returned
Additional arguments. None implemented
The function may not work well when the size (number of cells) of some strata is relatively small.
matrix of cell numbers (and optionally coordinates) by stratum