nlayers: Number of layers

Description Usage Arguments Value See Also Examples

Description

Get the number of layers in a Raster* object, typically used with a (multilayer) RasterStack or RasterBrick object

Usage

1

Arguments

x

Raster* object

Value

integer

See Also

names

Examples

1
2
3
4
5
6
7
8
r <- raster(ncols=10, nrows=10)
values(r) <- 1:ncell(r)
s <- stack(r, r, r)
nlayers(s)
s <- stack(s,s)
nlayers(s)
s <- dropLayer(s, 2:3)
nlayers(s)

raster documentation built on Jan. 5, 2021, 3:01 a.m.