Standardizes predictors by converting them into z-scores.

std_vars(pred, as_matrix = TRUE)

Arguments

pred

An object of class SpatRaster or matrix or data.frame

as_matrix

Logical. If TRUE a matrix will be returned

Value

A matrix or SpatRaster of standarized predictors

Details

if as_matrix is FALSE and pred is a SpatRaster, the function would return an SpatRaster object.

Examples

pred_path <- system.file("extdata/G_layers", package = "smop") |>
                         list.files(full.names=TRUE)
pred <- terra::rast(pred_path)
std_bios <- smop::std_vars(pred,as_matrix=FALSE)
terra::plot(std_bios)