get_area_patches: get_area_patches

View source: R/prepare_extras.R

get_area_patchesR Documentation

get_area_patches

Description

Get areas of patches for each class

Usage

get_area_patches(class_patches, classes, resolution)

Arguments

class_patches

A list with matrices of patches for each class (output of get_class_patches)

classes

A vector with unique values (output of get_unique_values_int)

resolution

A vector with two numbers (usually calculated using terra::res)

Details

Calculate areas of patches for each class

Value

list with vectors of areas 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)
area_patches <- get_area_patches(class_patches, classes, resolution = terra::res(landscape))


r-spatialecology/landscapemetrics documentation built on April 3, 2024, 2:21 a.m.