stackSelect: Select cell values from a multi-layer Raster* object

Description Usage Arguments Value See Also Examples

Description

Use a Raster* object to select cell values from different layers in a multi-layer Raster* object. The object to select values y should have cell values between 1 and nlayers(x). The values of y are rounded.

See extract for extraction of values by cell, point, or otherwise.

Usage

1
2
## S4 method for signature 'RasterStackBrick,Raster'
stackSelect(x, y, recycle=FALSE, type='index', filename='', ...)

Arguments

x

RasterStack or RasterBrick object

y

Raster* object

recycle

Logical. Recursively select values (default = FALSE. Only relevant if y has multiple layers. E.g. if x has 12 layers, and y has 4 layers, the indices of the y layers are used three times.

type

Character. Only relevant when recycle=TRUE. Can be 'index' or 'truefalse'. If it is 'index', the cell values of y should represent layer numbers. If it is 'truefalse' layer numbers are indicated by 0 (not used, NA returned) and 1 (used)

filename

Character. Output filename (optional)

...

Additional arguments as for writeRaster

Value

Raster* object

See Also

stackApply, extract

Examples

1
2
3
4
5
r <- raster(ncol=10, nrow=10)
r[] <- 1
s <- stack(r, r+2, r+5)
r[] <- round((runif(ncell(r)))*3)
x <- stackSelect(s, r)


Search within the raster package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.