names.Rd
Get or set the names of the layers of a Raster* object
# S4 method for class 'Raster'
names(x)
# S4 method for class 'Raster'
names(x) <- value
# S4 method for class 'Raster'
labels(object)
Character
nlayers, bands
r <- raster(ncols=5, nrows=5)
values(r) <- 1:ncell(r)
s <- stack(r, r, r)
nlayers(s)
#> [1] 3
names(s)
#> [1] "layer.1" "layer.2" "layer.3"
names(s) <- c('a', 'b', 'c')
names(s)[2] <- 'hello world'
names(s)
#> [1] "a" "hello.world" "c"
s
#> class : RasterStack
#> dimensions : 5, 5, 25, 3 (nrow, ncol, ncell, nlayers)
#> resolution : 72, 36 (x, y)
#> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> names : a, hello.world, c
#> min values : 1, 1, 1
#> max values : 25, 25, 25
#>
labels(s)
#> [1] "a" "hello.world" "c"