Learn R Programming

landscapemetrics (version 2.1.4)

get_class_patches: get_class_patches

Description

Get patches for each class

Usage

get_class_patches(landscape_mat, classes, directions)

Value

list with matrices of patches for each class

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

Examples

Run this code
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)

Run the code above in your browser using DataLab