This function prepares spatially explicit planning unit, species data, and landscape data layers for RAP processing.

make.RapData(
  pus,
  species,
  spaces = NULL,
  amount.target = 0.2,
  space.target = 0.2,
  n.demand.points = 100L,
  kernel.method = c("ks", "hypervolume")[1],
  quantile = 0.5,
  species.points = NULL,
  n.species.points = ceiling(0.2 * terra::global(species, "sum", na.rm = TRUE)[[1]]),
  include.geographic.space = TRUE,
  scale = TRUE,
  verbose = FALSE,
  ...
)

Arguments

pus

sf::st_as_sf() with planning unit data.

species

terra::rast() with species probability distribution data.

spaces

list of/or terra::rast() representing projects of attribute space over geographic space. Use a list to denote separate attribute spaces.

amount.target

numeric vector for area targets (%) for each species. Defaults to 0.2 for each attribute space for each species.

space.target

numeric vector for attribute space targets (%) for each species. Defaults to 0.2 for each attribute space for each species and each space.

n.demand.points

integer number of demand points to use for each attribute space for each species. Defaults to 100L.

kernel.method

character name of kernel method to use to generate demand points. Use either "ks" or "hypervolume".

quantile

numeric quantile to generate demand points within. If species.points intersect. Defaults to 0.5.

species.points

list of/or sf::st_sf() object species presence records. Use a list of objects to represent different species. Must have the same number of elements as species. If not supplied then use n.species.points to sample points from the species distributions.

n.species.points

numeric vector specifying the number points to sample the species distributions to use to generate demand points. Defaults to 20% of the distribution.

include.geographic.space

logical should the geographic space be considered an attribute space?

scale

logical scale the attribute spaces to unit mean and standard deviation? This prevents overflow. Defaults to TRUE.

verbose

logical print statements during processing?

...

additional arguments to calcBoundaryData() and calcSpeciesAverageInPus().

Value

A new RapData object.

See also

Examples

# \dontrun{
# load data
cs_pus <- sf::read_sf(
 system.file("extdata", "cs_pus.gpkg", package = "raptr")
)
cs_spp <- terra::rast(
  system.file("extdata", "cs_spp.tif", package = "raptr")
)
cs_space <- terra::rast(
  system.file("extdata", "cs_space.tif", package = "raptr")
)
# make RapData object using the first 10 planning units in the dat
x <- make.RapData(cs_pus[1:10,], cs_spp, cs_space,
                  include.geographic.space = TRUE)
# print object
print(x)
#> RapData object.
#>   Number of planning units: 10
#>   Number of species: 4
#>   Number of attribute spaces: 2
# }