names function

Names of raster layers

Names of raster layers

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

## S4 method for signature 'Raster' names(x) ## S4 replacement method for signature 'Raster' names(x)<-value ## S4 method for signature 'Raster' labels(object)

Arguments

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

Returns

Character

See Also

nlayers, bands

Examples

r <- raster(ncols=5, nrows=5) values(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)
  • Maintainer: Robert J. Hijmans
  • License: GPL (>= 3)
  • Last published: 2025-03-28