prepare_extras: prepare_extras

View source: R/prepare_extras.R

prepare_extrasR Documentation

prepare_extras

Description

Prepare an extras object

Usage

prepare_extras(
  metrics,
  landscape_mat,
  directions,
  neighbourhood,
  ordered,
  base,
  resolution
)

Arguments

metrics

A vector with metric abbreviations

landscape_mat

A matrix object

directions

The number of directions in which patches should be connected: 4 (rook's case) or 8 (queen's case).

neighbourhood

The number of directions in which cell adjacencies are considered as neighbours: 4 (rook's case) or 8 (queen's case). The default is 4.

ordered

The type of pairs considered. Either ordered (TRUE) or unordered (FALSE). The default is TRUE.

base

The unit in which entropy is measured. The default is "log2", which compute entropy in "bits". "log" and "log10" can be also used.

resolution

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

Details

Wrapper around terra::xyFromCell and terra::getValues to get raster_to_points function including NA values

Value

A list with zero or more of the following components:

  • points: matrix with three columns: col, row, value

  • classes: vector with unique values

  • class_patches: list with matrices of patches for each class

  • area_patches: list with vectors of areas of patches for each class

  • composition_vector: vector with the number of cells for each class

  • neighbor_matrix: matrix with the number of cell pairs for each class

  • comp: entropy of the neighbor_matrix

  • cplx: complexity of the landscape

  • enn_patch: matrix with the euclidean nearest neighbour distance for each patch

See Also

get_points, get_class_patches, get_area_patches, get_complexity, get_enn_patch

Examples

landscape <- terra::rast(landscapemetrics::landscape)
landscape_mat <- terra::as.matrix(landscape, wide = TRUE)
prepare_extras("lsm_l_ent", landscape_mat, neighbourhood = 4, base = "log2")

## Not run: 
metrics = list_lsm()$function_name
landscape <- terra::rast(landscapemetrics::landscape)
landscape_mat <- terra::as.matrix(landscape, wide = TRUE)
prepare_extras(metrics, landscape_mat, directions = 8, neighbourhood = 4,
               ordered = FALSE, base = "log2", resolution = terra::res(landscape))

## End(Not run)


landscapeecology/landscapemetrics documentation built on April 7, 2024, 11:11 p.m.