Skip to contents

Percentage of the land area of the automatic and the final M in each class of a categorical raster, such as the CHELSA Koppen-Geiger map. Useful to describe M and to see what expert additions or alternative scenarios change.

Usage

m_class_shares(m, raster, labels = NULL, fact = 1)

Arguments

m

An m_area object.

raster

Categorical raster (classes as integers).

labels

Optional class labels, indexed by class value (e.g. koppen_geiger_labels()).

fact

Aggregation factor (modal) to speed up large rasters.

Value

A data.frame with class, label, pct_automatic and pct_M.

Examples

sim <- simulate_enm_data(seed = 1, n_presence = 150)
m <- delimit_m(sim$presence, link_km = 120, thin_km = 5)
# two classes (1 = west, 2 = east) from a continuous layer
cls <- terra::classify(sim$env[["env1"]],
                       rbind(c(-Inf, 0.5, 1), c(0.5, Inf, 2)))
m_class_shares(m, cls, labels = c("west", "east"))
#>   class label pct_automatic pct_M
#> 1     1  west         47.16 47.16
#> 2     2  east         52.84 52.84