This function is called by the prep_scale module and scales the values of a SpatRaster using a method equivalent to terra::scale

prep_scale(covs, logger = NULL)

Arguments

covs

SpatRaster. The covariates to be scaled.

logger

Stores all notification messages to be displayed in the Log Window. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL

Value

a list containing the scaled SpatRaster and a dataframe with the parameters used for scaling

Author

Simon Smart simon.smart@cantab.net

Examples

covariate_files <- list.files(system.file("extdata", "covariates",
                              package = "disagapp"), full.names = TRUE)
covariate_list <- lapply(covariate_files, terra::rast)
covariates <- terra::rast(covariate_list)
result <- prep_scale(covs = covariates)
scaled_covariates <- result$covariates