units function

units of SpatRaster or SpatRasterDataSet

units of SpatRaster or SpatRasterDataSet

Get or set the units of the layers of a SpatRaster or the datasets in a SpatRasterDataSet.

## S4 method for signature 'SpatRaster' units(x) ## S4 replacement method for signature 'SpatRaster' units(x)<-value ## S4 method for signature 'SpatRasterDataset' units(x) ## S4 replacement method for signature 'SpatRasterDataset' units(x)<-value

Arguments

  • x: SpatRaster
  • value: character

Returns

character

See Also

time, names

Examples

s <- rast(system.file("ex/logo.tif", package="terra")) units(s) <- c("m/s", "kg", "ha") units(s) s units(s) <- "kg" units(s)
  • Maintainer: Robert J. Hijmans
  • License: GPL (>= 3)
  • Last published: 2025-02-26