Skip to contents

Calculate the mean habitat connectivity across a set of selected parameters, variance in habitat connectivity, and the difference in ranks between mean habitat connectivity and habitat availability. The result is produced in form of maps plotted with predefined graphics settings. Currently, the settings for plot cannot be customized. Default value is TRUE for all logical arguments

Usage

connectivity(
  host,
  indices,
  global = FALSE,
  east = NULL,
  west = NULL,
  geoscale = NULL,
  res = reso(),
  pmean = TRUE,
  pvar = TRUE,
  pdiff = TRUE,
  outdir = tempdir()
)

Arguments

host

SpatRaster. A SpatRaster object for the spatial distribution of habitat availability (such as host availability or cropland density). Note that a valid input data for geohabnet is a raster layer of habitat availability (such as host availability), in which each grid cell has any values between zero and one. If you are using your own dataset, please also make sure that your raster layer is in the standard coordinate reference system (i.e., EPSG:4326), the only CRS supported by geohabnet for now.

indices

SpatRaster. Collection of risk indices.

global

Logical. Select TRUE if a global analysis is desired, FALSE otherwise. east and west are required when TRUE.

east

SpatRaster. Collection of risk indices on eastern extent.

west

SpatRaster. Collection of risk indices on western extent. When TRUE, geoscale is ignored. Default is TRUE.

geoscale

Vector. This refers to the geographical extent for the habitat connectivity analysis when global is set to FALSE. Default is NULL.

res

Numeric. This parameter refers to the spatial aggregation factor. This value is the number of cells that are grouped when aggregating a raster layer from fine to coarse spatial resolution to reduce computational costs. Setting this parameter to 1 would not aggregate the raster layers. Default is reso().

pmean

Logical. TRUE if a map of mean habitat connectivity should be plotted, FALSE otherwise.

pvar

Logical. TRUE if a map of the variance in habitat connectivity should be plotted, FALSE otherwise.

pdiff

Logical. TRUE if a map of the difference in the ranks between the mean habitat connectivity and habitat availability should be plotted, FALSE otherwise.

outdir

Character. Output directory for saving raster in TIFF format. Default is tempdir().

Value

Gmap. See details.

Details

indexes has a list of spatRaster objects resulting from the unique combinations of all parameters specified in either parameters.yaml or sean(). For each unique combination of parameters, an index of habitat connectivity is calculated for each location in a landscape. Then these indices are used to calculate the mean and the variance of habitat connectivity of a location across all specified parameters.

This function will save all the opted plots using - pmean, pvar and pdiff. File will be saved in provided value of outdir or tempdir(). If interactive() is TRUE, then plots can be seen in active plot window (e.g., plot panel in Rstudio). The maps are plotted using SpatRaster objects. These SpatRaster objects are also available as a return value of this function.

References

Yanru Xing, John F Hernandez Nopsa, Kelsey F Andersen, Jorge L Andrade-Piedra, Fenton D Beed, Guy Blomme, Mónica Carvajal-Yepes, Danny L Coyne, Wilmer J Cuellar, Gregory A Forbes, Jan F Kreuze, Jürgen Kroschel, P Lava Kumar, James P Legg, Monica Parker, Elmar Schulte-Geldermann, Kalpana Sharma, Karen A Garrett, Global Cropland connectivity: A Risk Factor for Invasion and Saturation by Emerging Pathogens and Pests, BioScience, Volume 70, Issue 9, September 2020, Pages 744–758, doi:10.1093/biosci/biaa067

Hijmans R (2023). terra: Spatial Data Analysis. R package version 1.7-46, https://CRAN.R-project.org/package=terra