subset

0th

Percentile

Subset layers in a Raster* object

Extract layers from a RasterStack or RasterBrick object.

Keywords
spatial
Usage
subset(x, ...)
Arguments
x
a RasterStack or RasterBrick object
...
Additional arguments. subset, which should indicate the layers (represented as integer or by their name). drop=TRUE. If TRUE, a selection of a single layer will be returned as a RasterLayer
Value

  • a Raster* object

See Also

dropLayer

Aliases
  • subset
  • subset,RasterStack-method
  • subset,RasterBrick-method
Examples
r <- raster(system.file("external/test.grd", package="raster"))
  s <- stack(r,r,r)
  sel <- subset(s, 2:3)
  sel <- subset(s, 2)
  sel <- subset(s, 2, drop=FALSE)
  
#  sel <- subset(s, 2:3) is equivalent to
  sel <- dropLayer(s, 1)
Documentation reproduced from package raster, version 1.4-10, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.