get_class_patches function

get_class_patches

get_class_patches

Get patches for each class

get_class_patches(landscape_mat, classes, directions)

Arguments

  • 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).

Returns

list with matrices of patches for each class

Details

Calculate patches for each class

Examples

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)