This function calculates similarity between two spatial rank maps using Schoener's D or the Jaccard index.
Usage
rank_similarity(
r1 = NULL,
r2 = NULL,
rstack = NULL,
method = c("schoener", "jaccard"),
threshold = NULL
)Arguments
- r1
A
SpatRasterrank map (from theterrapackage). Required ifrstackis not provided.- r2
A
SpatRasterrank map with the same dimensions asr1. Required ifrstackis not provided.- rstack
A
SpatRasterwith multiple layers. If provided, the function calculates pairwise coefficients between all layers.- method
Character, either
"schoener"(default) or"jaccard".- threshold
Numeric, required if
method = "jaccard". Cells with rank greater than or equal to this threshold are considered selected.
Value
A numeric value between 0 and 1 if comparing two rasters, or a
matrix of pairwise coefficients if using rstack.
See also
Other postprocessing:
cost_summary(),
coverage_distribution(),
feature_curves(),
feature_representation(),
priority_map(),
summary_curves()
Examples
# Create two example priority rank maps
r1 <- terra::rast(nrows = 5, ncols = 5)
terra::values(r1) <- runif(terra::ncell(r1))
r2 <- terra::rast(r1)
terra::values(r2) <- runif(terra::ncell(r2))
# Schoener's D
rank_similarity(r1, r2, method = "schoener")
#> [1] 0.6923096
# Jaccard index with threshold
rank_similarity(r1, r2, method = "jaccard", threshold = 0.7)
#> [1] 0.1333333
