R/set_attributes.R

Defines functions set_attributes

Documented in set_attributes

#' Set attributes for SpatRaster
#'
#' @param x SpatRaster - to assign attributes to
#' @param type character - type of attributes i.e. "stages"
#' @family Helper
#' @keywords internal


set_attributes <- function(x, type) {

  lev <- get_legend(type)[,c("ID", "category")]

  for (i in 1:terra::nlyr(x)) levels(x[[i]]) <- lev

  #names(x) <- timename(x, type)

  return(x)

}

Try the PHENTHAUproc package in your browser

Any scripts or data that you put into this service are public.

PHENTHAUproc documentation built on June 22, 2024, 7:12 p.m.