Last chance! 50% off unlimited learning
Sale ends in
sampleRandom(x, size, ...)
sampleRegular(x, size, extent=NULL, cells=FALSE, asRaster=FALSE, corners=FALSE)
na.rm, extent, and cells
. If TRUE
NA values are removed from random sampleTRUE
, a rasterLayer is returned, rather then the sampled valuesTRUE
, the extreme corner cells are always included. This makes for rather irregular sampling when n is small; but it can be useful when asRaster=TRUE, to maintain the same extent as the input RasterLayerr <- raster(system.file("external/test.grd", package="raster"))
v <- sampleRegular(r, size=100)
s <- stack(r, r)
sampleRandom(s, size=10, cells=TRUE)
Run the code above in your browser using DataLab