getValues

0th

Percentile

Get raster cell values

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).

Keywords
methods, spatial
Usage
getValues(x, row, nrows, ...)
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
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.

Value

  • vector or matrix of raster values

Aliases
  • getValues
  • getValues,RasterLayer,missing,missing-method
  • getValues,RasterStack,missing,missing-method
  • getValues,RasterBrick,missing,missing-method
  • getValues,RasterLayer,numeric,missing-method
  • getValues,RasterStack,numeric,missing-method
  • getValues,RasterBrick,numeric,missing-method
  • getValues,RasterLayer,numeric,numeric-method
  • getValues,RasterStack,numeric,numeric-method
  • getValues,RasterBrick,numeric,numeric-method
Examples
r <- raster(system.file("external/test.grd", package="raster"))
getValues(r)
getValues(r, row=10)
Documentation reproduced from package raster, version 1.0.0-1, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.