names | R Documentation |
Get or set the names of the layers of a SpatRaster or the attributes of a SpatVector.
See set.names
for in-place setting of names.
## S4 method for signature 'SpatRaster'
names(x)
## S4 replacement method for signature 'SpatRaster'
names(x)<-value
## S4 method for signature 'SpatRasterDataset'
names(x)
## S4 replacement method for signature 'SpatRasterDataset'
names(x)<-value
## S4 method for signature 'SpatVector'
names(x)
## S4 replacement method for signature 'SpatVector'
names(x)<-value
x |
SpatRaster, SpatRasterDataset, or SpatVector |
value |
character (vector) |
character
terra enforces neither unique nor valid names. See make.unique
to create unique names and make.names
to make syntactically valid names.
s <- rast(ncols=5, nrows=5, nlyrs=3)
nlyr(s)
names(s)
names(s) <- c("a", "b", "c")
names(s)
# SpatVector names
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
names(v)
names(v) <- paste0(substr(names(v), 1, 2), "_", 1:ncol(v))
names(v)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.