Skip to contents

Calculate mean, variance and difference. The result is produced in form of maps plotted with predefined 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. Host density map aka SpatRaster object

indices

SpatRaster. Collection of risk indices.

global

Logical. TRUE if 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. geographical scale. Default is NULL.

res

Numeric. Map resolution. This value is used in aggregation and dis-aggregation operation. Default is reso().

pmean

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

pvar

Logical. TRUE if variance map should be plotted, FALSE otherwise.

pdiff

Logical. TRUE if difference map should be plotted, FALSE otherwise.

outdir

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

Value

Gmap. See details.

Details

indexes are actually risk indices i.e. lis of spatRaster objects resulting from operations on crop's raster and parameters provided in either parameters.yaml or sean().

It 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. Rstudio. The maps are plotted using SpatRaster object. These objects are 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