raster (version 2.1-41)

names: Names of raster layers

Description

Get or set the names of the layers of a Raster* object

Usage

## S3 method for class 'Raster':
names(x)

## S3 method for class 'Raster':
names(x)<-value

## S3 method for class 'Raster':
labels(object)

Arguments

x
Raster* object
object
Raster* object
value
character (vector)

Value

  • Character

See Also

nlayers, bands

Examples

Run this code
r <- raster(ncols=5, nrows=5)
r[] <- 1:ncell(r)
s <- stack(r, r, r)
nlayers(s)
names(s)
names(s) <- c('a', 'b', 'c')
names(s)[2] <- 'hello world'
names(s)
s
labels(s)

Run the code above in your browser using DataLab