View source: R/prepare_extras.R
get_class_patches | R Documentation |
Get patches for each class
get_class_patches(landscape_mat, classes, directions)
landscape_mat |
A matrix object |
classes |
A vector with unique values (output of get_unique_values_int) |
directions |
The number of directions in which patches should be connected: 4 (rook's case) or 8 (queen's case). |
Calculate patches for each class
list with matrices of patches for each class
landscape <- terra::rast(landscapemetrics::landscape)
landscape_mat <- terra::as.matrix(landscape, wide = TRUE)
classes <- landscapemetrics:::get_unique_values_int(landscape_mat)
class_patches <- get_class_patches(landscape_mat, classes, directions = 8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.