addLayer: Add or drop a layer

Description Usage Arguments Value See Also Examples

Description

Add a layer to a Raster* object or drop a layer from a RasterStack or RasterBrick. The object returned is always a RasterStack (unless nothing to add or drop was provided, in which case the original object is returned).

Usage

1
2

Arguments

x

Raster* object

i

integer. Indices of the layers to be dropped

...

Additional arguments. The layers to add for addLayer. None for dropLayer)

Value

RasterStack

See Also

subset

Examples

1
2
3
4
5
6
7
file <- system.file("external/test.grd", package="raster")
s <- stack(file, file, file)
r <- raster(file)
s <- addLayer(s, r/2, r*2)
s
s <- dropLayer(s, c(3, 5))
nlayers(s)


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.