getValues returns all values or a row of values for a Raster* object. It will take them from memory if available, else it will read them from disk.
This is the prefered function to get either all values, or a subset of rows from a RasterLayer (it is safer then read* functions, which will fail if there is no file). Function values is a shorthand version of getValues that might eventually replace getValues.
Usage
getValues(x, row, nrows, ...)
values(x, ...)
Arguments
x
Raster* object
row
Numeric. Row number, should be between 1 and nrow(x), or missing in which case all values are returned
nrows
Numeric. Number of rows. Should be an integer number > 0, or missing
...
Additional arguments, see Details
Value
vector or matrix of raster values
Details
Additional arguments when x is a RasterLayer:
format Character. specifiy the output format. Either '' or 'matrix'. The default is '', in which case a vector is returned.
The values returned for a RasterStack or RasterBrick are always a matrix.