createRichnessMaps: Create regular and dispersal-constrained richness maps from...

View source: R/createRichnessMaps.R

createRichnessMapsR Documentation

Create regular and dispersal-constrained richness maps from stacked SDMs

Description

This function stacks binary (presence/absence) species distribution maps to create richness maps for a list of species. If higher taxa are provided (i.e., mammals), separate richness maps for each higher taxon will be created in addition to the full species richness maps. Given hindcasted/forecasted binary maps, future/past species richness will also be calculated. Rasters and .pdf files of each are generated, and the legend is standardized across all .pdf maps for effective comparisons. Finally, provided distribution maps that are constrained by dispersal rate, this function compares between the dispersal-constrained and regular richness maps.

Usage

createRichnessMaps(
  result_dir,
  time_periods,
  scenarios = NA,
  dispersal = FALSE,
  taxonlist = FALSE
)

Arguments

result_dir

the directory where the ensembled and binary maps are placed. Each species should have its own sub-directory, and the forecasted/hindcasted binary maps should be placed into directories like so: Species/Scenario/Time. If projectSuit was used to make these maps, this is probably the same as the output argument in that function.

time_periods

a vector of the years in which the projection will occur with the first element as the original year (the year in which the model was generated). If no precise years are available for future/past time periods (e.g., using data from the Last Glacial Maximum), order the remaining time periods from most current to least current (farthest into the future/past) and give character strings for the years (e.g., "LGM").

scenarios

a vector of character strings detailing the different climate models used in the forecasted/hindcasted species distribution models. If no projection is needed, set to NA (default).

dispersal

(logical TRUE or FALSE) Are dispersal rate analyses needed? If set to TRUE, this function constructs dispersal-constrained richness maps for all time periods/scenarios given, and compares those maps to the non-dispersal constrained maps. If these analysis are not needed, or if the megaSDM::dispersalRate function has yet to be run, this should be set to FALSE (default).

taxonlist

(optional) data.frame or .csv file path name. If taxon-specific species richness maps are required, this should correspond to a list of all species modelled (Column 1) and a selected higher taxon (Column 2; e.g., Order, Class) to split the richness maps on. If taxon-specific richness maps are not required, taxonlist should be set to FALSE (default).

Value

writes .pdf files and rasters (.grd) of species richness for all given taxa, time periods, and scenarios and dispersal constraints to the directory "result_dir/RichnessMaps".


brshipley/megaSDM documentation built on Nov. 26, 2024, 6:08 a.m.