powered by
Take a regular sample of a SpatRaster. Either get cell values, or a new SpatRaster with the same extent, but fewer cells.
# S4 method for SpatRaster spatSample(x, size, method="regular", as.raster=FALSE, ...)
SpatRaster
numeric. The sample size
character. Should be "regular" (more to come)
logical. If TRUE, a SpatRaster is returned
TRUE
additional arguments. None implemented
numeric or SpatRaster
# NOT RUN { f <- system.file("exdata/test.tif", package="terra") r <- rast(f) s <- spatSample(r, 100) head(s) ss <- spatSample(r, 100, as.raster=TRUE) ss # }
Run the code above in your browser using DataLab