get_class_patches: get_class_patches

View source: R/prepare_extras.R

get_class_patchesR Documentation

get_class_patches

Description

Get patches for each class

Usage

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

Details

Calculate patches for each class

Value

list with matrices of 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)


landscapemetrics documentation built on Sept. 12, 2024, 7:42 a.m.