Calculate the perimeter of a reserve network

reserve_perimeter(pu, x, units = c("km", "m"))

Arguments

pu

raster::RasterStack, sp::SpatialPolygonsDataFrame, or sf::sf object; planning units and representation levels of features as layers (raster inputs) or columns (vector inputs).

x

logical or binary; indicator variables specifying which planning units are included.

units

character; metapopulation capacity depends on the units used for the areas and distances, this argument determines whether these are measured in meters or kilometers.

Value

A units object giving the reserve perimeter in the specified units.

Examples

r <- raster::raster(nrows = 10, ncols = 10, crs = "+proj=aea", vals = sample(0:1, 100, replace = TRUE)) selected <- sample(c(FALSE, TRUE), 100, replace = TRUE, prob = c(0.7, 0.3)) reserve_perimeter(r, selected)
#> 2.412 km