get_enn_patch: get_enn_patch

View source: R/prepare_extras.R

get_enn_patchR Documentation

get_enn_patch

Description

Euclidean Nearest-Neighbor Distance

Usage

get_enn_patch(classes, class_patches, points, resolution, verbose = FALSE)

Arguments

classes

A vector with unique values (output of get_unique_values_int)

class_patches

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

points

A matrix with three columns: col, row, value (output of get_points)

resolution

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

verbose

A logical indicating whether to print warnings

Details

Calculate Euclidean Nearest-Neighbor Distance for each patch in each class

Value

tibble with two columns: class, value

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)
points <- get_points(landscape_mat, terra::res(landscape))
enns <- get_enn_patch(classes, class_patches, points, terra::res(landscape))


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