sampleRandom(x, size, ...)
na.rm
Logical. If TRUE
(the default), NA
values are removed from random sample
extent
Extent. To limit regular sampling to the area within the extent
cell
cells=TRUE
; or for a multi-layered object), or a SpatialPointsDataFrame (if sp=TRUE
)na.rm=TRUE
, the returned sample may be smaller than requestedsampleRegular
r <- raster(system.file("external/test.grd", package="raster"))
sampleRandom(r, size=10)
s <- stack(r, r)
sampleRandom(s, size=10, cells=TRUE, sp=TRUE)
Run the code above in your browser using DataLab