## S3 method for class 'Raster':
sampleRegular(x, size, ext=NULL, cells=FALSE, xy=FALSE, asRaster=FALSE,
sp=FALSE, useGDAL=FALSE, ...)
TRUE
, coordinates of sampled cells are also returnedTRUE
, a RasterLayer or RasterBrick is returned, rather then the sampled valuesTRUE
, a SpatialPointsDataFrame is returnedTRUE
, GDAL is used to sample in some cases. This is quicker, but can result in values for a different set of cells. Only for rasters that are accessed via rgdal, are not rotated, and when cells=FALSE
cells=TRUE
, or xy=TRUE
), Raster* object (if asRaster=TRUE
), or SpatialPointsDataFrame (if sp=TRUE
)sampleRandom
, sampleStratifiedr <- raster(system.file("external/test.grd", package="raster"))
v <- sampleRegular(r, size=100)
x <- sampleRegular(r, size=100, asRaster=TRUE)
Run the code above in your browser using DataLab