Title: | IUCN Redlisting Tools |
---|---|
Description: | Includes algorithms to facilitate the assessment of extinction risk of species according to the IUCN (International Union for Conservation of Nature, see <https://www.iucn.org/> for more information) red list criteria. |
Authors: | Pedro Cardoso [aut] , Vasco V. Branco [cre, aut] |
Maintainer: | Vasco V. Branco <[email protected]> |
License: | GPL-3 |
Version: | 1.6.1 |
Built: | 2024-11-14 05:46:35 UTC |
Source: | https://github.com/vascobranco/red |
Calculates the Area of Occupancy of a species based on either known records or predicted distribution.
aoo(spData)
aoo(spData)
spData |
One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (either 0/1 or probabilistic values). |
AOO is calculated as the area of all known or predicted cells for the species. The resolution will be 2x2km as required by IUCN.
A single value in km2 or a vector with lower confidence limit, consensus and upper confidence limit (probabilities 0.975, 0.5 and 0.025 respectively).
range = red.examples("red.range") aoo(range)
range = red.examples("red.range") aoo(range)
Extracts the names or ISO codes of countries of occurrence of a species based on either records or predicted distribution.
countries(spData, zone = NULL, ISO = FALSE)
countries(spData, zone = NULL, ISO = FALSE)
spData |
One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (0/1 values). |
zone |
UTM zone if data is in metric units. |
ISO |
Outputs either country names (FALSE) or ISO codes (TRUE). |
Country boundaries and designations are based on data(worldborders) from package maptools.
A vector with country names or codes.
records = red.examples("red.records") range = red.examples("red.range") countries(records) countries(range, ISO = TRUE)
records = red.examples("red.records") range = red.examples("red.range") countries(records) countries(range, ISO = TRUE)
Calculates the elevation (or depth) limits (range) of a species based on either known records or predicted distribution.
elevation(spData, dem = NULL)
elevation(spData, dem = NULL)
spData |
One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (0/1 values). |
dem |
RasterLayer object. Should be a digital elevation model (DEM) of the relevant area. If not given the function will try to read it from base data, only works with longlat data. |
Maximum and minimum elevation are calculated based on the DEM.
A vector with two values (min and max) in meters above (or below) sea level.
records = red.examples("red.records") range = red.examples("red.range") layers = red.examples("red.layers") dem = layers[[3]] elevation(records, dem) elevation(range, dem)
records = red.examples("red.records") range = red.examples("red.range") layers = red.examples("red.layers") dem = layers[[3]] elevation(records, dem) elevation(range, dem)
Calculates the Extent of Occurrence of a species based on either records or predicted distribution.
eoo(spData)
eoo(spData)
spData |
spData One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (either 0/1 or probabilistic values). |
EOO is calculated as the minimum convex polygon covering all known or predicted sites for the species.
A single value in km2 or a vector with lower confidence limit, consensus and upper confidence limit (probabilities 0.975, 0.5 and 0.025 respectively).
records = red.examples("red.records") range = red.examples("red.range") eoo(records) eoo(range)
records = red.examples("red.records") range = red.examples("red.range") eoo(records) eoo(range)
Creates kml files for Google Maps as required by IUCN guidelines.
kml(spData, zone = NULL, filename, mapoption = "aoo", smooth = 0, rad = 0.1)
kml(spData, zone = NULL, filename, mapoption = "aoo", smooth = 0, rad = 0.1)
spData |
One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (0/1 values). |
zone |
UTM zone if data is in metric units. |
filename |
The name of file to save, should end with .kml. |
mapoption |
Type of representation, any of "points", "eoo" or "aoo". |
smooth |
Smooths the kml lines as per IUCN guidelines. Higher values represent smoother polygons. |
rad |
radius of circles in degrees if mapoption is "points". It can be the same value for all points or a vector with length equal to number of records in spData representing associated error. The default is about 10km (0.1 degrees) as per IUCN guidelines. |
A kml with polygon or circles around records.
Creates maps ready to print in pdf or other formats.
map.draw( longlat = NULL, layer, spName, borders = FALSE, scale = TRUE, legend = FALSE, sites = TRUE, mcp = FALSE, print = FALSE )
map.draw( longlat = NULL, layer, spName, borders = FALSE, scale = TRUE, legend = FALSE, sites = TRUE, mcp = FALSE, print = FALSE )
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record. |
layer |
RasterLayer object representing the presence/absence map for the species. |
spName |
String of species name. |
borders |
If TRUE country borders are drawn. |
scale |
If TRUE a distance scale in km is drawn. |
legend |
If TRUE the legend for the map is drawn. |
sites |
If TRUE the record locations are drawn. |
mcp |
If TRUE the minimum convex polygon representing the Extent of Occurrence is drawn. |
print |
If TRUE a pdf is saved instead of the output to the console. |
records = red.examples("red.records") range = red.examples("red.range") par(mfrow = c(1,2)) map.draw(records, layer = range, mcp = TRUE)
records = red.examples("red.records") range = red.examples("red.range") par(mfrow = c(1,2)) map.draw(records, layer = range, mcp = TRUE)
Single step for prediction of multiple species distributions. Output of maps (in pdf format), klms (for Google Earth) and relevant data (in csv format).
map.easy( longlat, layers = NULL, habitat = NULL, zone = NULL, thin = TRUE, error = NULL, move = TRUE, dem = NULL, pca = 0, filename = NULL, mapoption = NULL, testpercentage = 0, mintest = 20, points = FALSE, runs = 0, subset = 0 )
map.easy( longlat, layers = NULL, habitat = NULL, zone = NULL, thin = TRUE, error = NULL, move = TRUE, dem = NULL, pca = 0, filename = NULL, mapoption = NULL, testpercentage = 0, mintest = 20, points = FALSE, runs = 0, subset = 0 )
longlat |
data.frame of taxon names, longitude and latitude or eastness and northness (three columns in this order) of each occurrence record. |
layers |
If NULL analyses are done with environmental layers read from data files of red.setup(). If a Raster* object as defined by package raster, analyses use these. |
habitat |
Raster* object as defined by package raster. Habitat extent layer (0/1) used instead of layers if any species is an habitat specialist. |
zone |
UTM zone if data is in metric units. Used only for correct placement of kmls and countries. |
thin |
boolean defining if species data should be thinned before modeling (only for SDMs). |
error |
Vector of spatial error in longlat (one element per row of longlat) in the same unit as longlat. Used to move any point randomly within the error radius. |
move |
If TRUE, identifies and moves presence records to closest cells with environmental data. Use when spatial error might put records outside such data. |
dem |
RasterLayer object. It should be a digital elevation model for calculation of elevation limits of the species. If NULL, dem from red.setup() is used if possible, otherwise it will be 0. |
pca |
Number of pca axes for environmental data reduction. If 0 (default) no pca is made. |
filename |
Name of output csv file with all results. If NULL it is named "Results_All.csv". |
mapoption |
Vector of values within options: points, habitat and sdm; each value corresponding to the function to be used for each species (map.points, map.habitat, map.sdm). If a single value, all species will be modelled according to it. If NULL, the function will perform analyses using map.points. Species values must be in same order as latlong. |
testpercentage |
Percentage of records used for testing only. If 0 all records will be used for both training and testing. |
mintest |
Minimim number of total occurrence records of any species to set aside a test set. Only used if testpercentage > 0. |
points |
If TRUE, force map to include cells with presence records even if suitable habitat was not identified. |
runs |
If <= 0 no ensemble modelling is performed. If > 0, ensemble modelling with n runs is made. For each run, a new random sample of occurrence records (if testpercentage > 0), background points and predictive variables (if subset > 0) are chosen. In the ensemble model, each run is weighted as max(0, (runAUC - 0.5)) ^ 2. |
subset |
Number of predictive variables to be randomly selected from layers for each run if runs > 0. If <= 0 all layers are used on all runs. Using a small number of layers is usually better than using many variables for rare species, with few occurrence records (Lomba et al. 2010, Breiner et al. 2015). |
Outputs maps in asc, pdf and kml format, plus a file with EOO, AOO and a list of countries where the species is predicted to be present if possible to extract.
Breiner, F.T., Guisan, A., Bergamini, A., Nobis, M.P. (2015) Overcoming limitations of modelling rare species by using ensembles of small models. Methods in Ecology and Evolution, 6: 1210-1218.
Lomba, A., Pellissier, L., Randin, C.F., Vicente, J., Moreira, F., Honrado, J., Guisan, A. (2010) Overcoming the rare species modelling paradox: a novel hierarchical framework applied to an Iberian endemic plant. Biological Conservation, 143: 2647-2657.
Mapping of all habitat patches where the species is known to occur.
map.habitat( longlat, layer, move = TRUE, mcp = FALSE, points = FALSE, eval = TRUE )
map.habitat( longlat, layer, move = TRUE, mcp = FALSE, points = FALSE, eval = TRUE )
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record. |
layer |
RasterLayer object representing the presence/absence (1/0) of a single habitat type. |
move |
If TRUE, identifies and moves presence records to closest cells with suitable habitat. Use when spatial error might put records outside the correct patch. |
mcp |
If TRUE, all habitat patches inside the minimum convex hull polygon encompassing all occurrence records are converted to presence. |
points |
If TRUE, force map to include cells with presence records even if suitable habitat was not identified. |
eval |
If TRUE, build a matrix with EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model). |
In many cases a species has a very restricted habitat and we generally know where it occurs. In such cases using the distribution of the known habitat patches may be enough to map the species.
One raster object and, if eval = TRUE, a matrix with EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model).
Mapping of all cells where the species is known to occur.
map.points(longlat, layers, eval = TRUE)
map.points(longlat, layers, eval = TRUE)
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record. |
layers |
Raster* object as defined by package raster. Any raster with the relevant extent and cell size can be used. |
eval |
If TRUE, build a matrix with EOO and AOO calculated from occurrence records only. |
To be used if either information on the species is very scarce (and it is not possible to model the species distribution) or, on the contrary, complete (and there is no need to model the distribution).
One raster object and, if EVAL = TRUE, a matrix with EOO and AOO.
records = red.examples("red.records") layers = red.examples("red.layers") terra::plot(map.points(records, layers, eval = FALSE)) points(records)
records = red.examples("red.records") layers = red.examples("red.layers") terra::plot(map.points(records, layers, eval = FALSE)) points(records)
Prediction of potential species distributions using maximum entropy (maxent).
map.sdm( longlat, layers, error = NULL, year = NULL, idconf = NULL, categorical = NULL, thres = 0, testpercentage = 0, mcp = TRUE, points = FALSE, eval = TRUE, runs = 0, subset = 0 )
map.sdm( longlat, layers, error = NULL, year = NULL, idconf = NULL, categorical = NULL, thres = 0, testpercentage = 0, mcp = TRUE, points = FALSE, eval = TRUE, runs = 0, subset = 0 )
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record. |
layers |
Predictor variables, a Raster* object as defined by package raster. |
error |
Vector of spatial error in longlat (one element per row of longlat) in the same unit as longlat. Used to move any point randomly within the error radius. |
year |
Vector of sampling years in longlat (one element per row of longlat). Used to exclude old records with a given probability proportional to time passed since sampling (never excluded only for current year). |
idconf |
Vector of identification confidence in longlat (one element per row of longlat). Used to exclude uncertain records with a given probability. Can be on any scale where max values are certain (e.g. from 1 - very uncertain to 10 - holotype). |
categorical |
Vector of layer indices of categorical (as opposed to quantitative) data. If NULL the package will try to find them automatically based on the data. |
thres |
Threshold of logistic output used for conversion of probabilistic to binary (presence/absence) maps. If 0 this will be the value that maximizes the sum of sensitivity and specificity. |
testpercentage |
Percentage of records used for testing only. If 0 all records will be used for both training and testing. |
mcp |
Used for a precautionary approach. If TRUE, all areas predicted as present but outside the minimum convex hull polygon encompassing all occurrence records are converted to absence. Exceptions are cells connected to other areas inside the polygon. |
points |
If TRUE, force map to include cells with presence records even if suitable habitat was not identified. |
eval |
If TRUE, build a matrix with AUC, Kappa, TSS, EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model). |
runs |
If <= 0 no ensemble modelling is performed. If > 0, ensemble modelling with n runs is made. For each run, a new random sample of occurrence records (if testpercentage > 0), background points and predictive variables (if subset > 0) are chosen. In the ensemble model, each run is weighted as max(0, (runAUC - 0.5)) ^ 2. |
subset |
Number of predictive variables to be randomly selected from layers for each run if runs > 0. If <= 0 all layers are used on all runs. Using a small number of layers is usually better than using many variables for rare species, with few occurrence records (Lomba et al. 2010, Breiner et al. 2015). |
Builds maxent (maximum entropy) species distribution models (Phillips et al. 2004, 2006; Elith et al. 2011) using function maxent from R package dismo (Hijmans et al. 2017). Dismo requires the MaxEnt species distribution model software, a java program that can be downloaded from http://biodiversityinformatics.amnh.org/open_source/maxent. Copy the file 'maxent.jar' into the 'java' folder of the dismo package. That is the folder returned by system.file("java", package="dismo"). You need MaxEnt version 3.3.3b or higher. Please note that this program (maxent.jar) cannot be redistributed or used for commercial or for-profit purposes.
List with either one or two raster objects (depending if ensemble modelling is performed, in which case the second is a probabilistic map from all the runs) and, if eval = TRUE, a matrix with AUC, Kappa, TSS, EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model). Aggregate values are taken from maps after transformation of probabilities to incidence, with presence predicted for cells with ensemble values > 0.5.
Breiner, F.T., Guisan, A., Bergamini, A., Nobis, M.P. (2015) Overcoming limitations of modelling rare species by using ensembles of small models. Methods in Ecology and Evolution, 6: 1210-1218.
Hijmans, R.J., Phillips, S., Leathwick, J., Elith, J. (2017) dismo: Species Distribution Modeling. R package version 1.1-4. https://CRAN.R-project.org/package=dismo
Lomba, A., Pellissier, L., Randin, C.F., Vicente, J., Moreira, F., Honrado, J., Guisan, A. (2010) Overcoming the rare species modelling paradox: a novel hierarchical framework applied to an Iberian endemic plant. Biological Conservation, 143: 2647-2657.
Phillips, S.J., Dudik, M., Schapire, R.E. (2004) A maximum entropy approach to species distribution modeling. Proceedings of the Twenty-First International Conference on Machine Learning. p. 655-662.
Phillips, S.J., Anderson, R.P., Schapire, R.E. (2006) Maximum entropy modeling of species geographic distributions. Ecological Modelling, 190: 231-259.
Elith, J., Phillips, S.J., Hastie, T., Dudik, M., Chee, Y.E., Yates, C.J. (2011) A statistical explanation of MaxEnt for ecologists. Diversity and Distributions, 17: 43-57.
Identifies and moves presence records to cells with environmental values.
move(longlat, layers, buffer = 0)
move(longlat, layers, buffer = 0)
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records. |
layers |
SpatRaster* object as defined by package raster. |
buffer |
Maximum distance in map units that a record will move. If 0 all NA records will be changed. |
Often records are in coastal or other areas for which no environmental data is available. This function moves such records to the closest cells with data so that no information is lost during modelling.
A matrix with new coordinate values.
rast <- terra::rast(matrix(c(rep(NA,100), rep(1,100), rep(NA,100)), ncol = 15)) pts <- cbind(runif(100, 0, 5), runif(100, 0, 15)) terra::plot(rast) points(pts) pts <- move(pts, rast) terra::plot(rast) points(pts)
rast <- terra::rast(matrix(c(rep(NA,100), rep(1,100), rep(NA,100)), ncol = 15)) pts <- cbind(runif(100, 0, 5), runif(100, 0, 15)) terra::plot(rast) points(pts) pts <- move(pts, rast) terra::plot(rast) points(pts)
Draws plots of sites in geographical (longlat) and environmental (2-axis PCA) space.
outliers(longlat, layers)
outliers(longlat, layers)
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records. |
layers |
Raster* object as defined by package raster. It can be any set of environmental layers thought to allow the identification of environmental outliers. |
Erroneous data sources or errors in transcriptions may introduce outliers that can be easily detected by looking at simple graphs of geographical or environmental space.
A data.frame with coordinate values and distance to centroid in pca is returned. Two plots are drawn for visual inspection. The environmental plot includes row numbers for easy identification of possible outliers.
records = red.examples("red.records") layers = red.examples("red.layers") outliers(records, layers[[1:3]])
records = red.examples("red.records") layers = red.examples("red.layers") outliers(records, layers[[1:3]])
Crop raster layers to minimum size possible and uniformize NA values across layers.
raster.clean(layers)
raster.clean(layers)
layers |
Raster* object as defined by package raster. |
Excludes all marginal rows and columns with only NA values and change values to NA if they are NA in any of the layers.
A Raster* object, same class as layers.
layers = red.examples("red.layers") terra::plot(raster.clean(layers))
layers = red.examples("red.layers") terra::plot(raster.clean(layers))
Creates a layer depicting distances to records using the minimum, average, distance to the minimum convex polygon or distance taking into account a cost surface.
raster.distance(longlat, layers, type = "minimum")
raster.distance(longlat, layers, type = "minimum")
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records. |
layers |
Raster* object as defined by package raster to serve as model to create distance layer. Cost surface in case of param ="cost". |
type |
text string indicating whether the output should be the "minimum", "average", or "mcp" distance to all records. "mcp" means the distance to the minimum convex polygon encompassing all records. |
Using distance to records in models may help limiting the extrapolation of the predicted area much beyond known areas.
A RasterLayer object.
layers = red.examples("red.layers") alt = layers[[3]] records = red.examples("red.records") par(mfrow=c(3,2)) terra::plot(alt) points(records) terra::plot(raster.distance(records, alt)) terra::plot(raster.distance(records, alt, type = "average")) terra::plot(raster.distance(records, alt, type = "mcp"))
layers = red.examples("red.layers") alt = layers[[3]] records = red.examples("red.records") par(mfrow=c(3,2)) terra::plot(alt) points(records) terra::plot(raster.distance(records, alt)) terra::plot(raster.distance(records, alt, type = "average")) terra::plot(raster.distance(records, alt, type = "mcp"))
Create a layer depicting eastness based on an elevation layer.
raster.east(dem)
raster.east(dem)
dem |
RasterLayer object of elevation (a digital elevation model - DEM) as defined by package raster. |
Using elevation, aspect can be calculated. Yet, it is a circular variable (0 = 360) and has to be converted to northness and eastness to be useful for modelling.
A RasterLayer object.
layers = red.examples("red.layers") terra::plot(raster.east(layers[[3]]))
layers = red.examples("red.layers") terra::plot(raster.east(layers[[3]]))
Create a layer depicting latitude based on any other.
raster.lat(layers)
raster.lat(layers)
layers |
Raster* object as defined by package raster. |
Using latitude (and longitude) in models may help limiting the extrapolation of the predicted area much beyond known areas.
A RasterLayer object.
layers = red.examples("red.layers") terra::plot(raster.lat(layers[[1]]))
layers = red.examples("red.layers") terra::plot(raster.lat(layers[[1]]))
Create a layer depicting longitude based on any other.
raster.long(layers)
raster.long(layers)
layers |
Raster* object as defined by package raster. |
Using longitude (and latitude) in models may help limiting the extrapolation of the predicted area much beyond known areas.
A RasterLayer object.
layers = red.examples("red.layers") terra::plot(raster.long(layers))
layers = red.examples("red.layers") terra::plot(raster.long(layers))
Create a layer depicting northness based on an elevation layer.
raster.north(dem)
raster.north(dem)
dem |
RasterLayer object of elevation (a digital elevation model - DEM) as defined by package raster. |
Using elevation, aspect can be calculated. Yet, it is a circular variable (0 = 360) and has to be converted to northness and eastness to be useful for modelling.
A RasterLayer object.
layers = red.examples("red.layers") terra::plot(raster.north(layers[[3]]))
layers = red.examples("red.layers") terra::plot(raster.north(layers[[3]]))
Read raster layers of environmental or other variables and crop them to a given extent around the known occurrences.
raster.read(longlat, layers = NULL, ext = 1)
raster.read(longlat, layers = NULL, ext = 1)
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records. |
layers |
Raster* object as defined by package raster. |
ext |
Either extent of map or buffer around the known records used to crop layers. If buffer, it is relative to the maximum distance between any two records. |
If layers are not given, the function will read either 30 arc-second (approx. 1km) or 5 arc-minutes (approx. 10km) resolution rasters from worldclim (Fick & Hijmans 2017) and landcover (Tuanmu & Jetz 2014) if red.setup() is run previously.
A RasterStack object (If no layers are given: Variables 1-19 = bioclim, 20 = elevation, 21-32 = proportion landcover, 33 = most common landcover).
Fick, S.E. & Hijmans, R.J. (2017) Worldclim 2: new 1-km spatial resolution climate surfaces for global land areas. International Journal of Climatology, in press.
Tuanmu, M.-N. & Jetz, W. (2014) A global 1-km consensus land-cover product for biodiversity and ecosystem modeling. Global Ecology and Biogeography, 23: 1031-1045.
layers = red.examples("red.layers") records = red.examples("red.records") par(mfrow=c(1,2)) terra::plot(layers[[1]]) points(records) croppedLayers <- raster.read(records, layers, 0.1) terra::plot(croppedLayers[[1]]) points(records)
layers = red.examples("red.layers") records = red.examples("red.records") par(mfrow=c(1,2)) terra::plot(layers[[1]]) points(records) croppedLayers <- raster.read(records, layers, 0.1) terra::plot(croppedLayers[[1]]) points(records)
Reduce the number of layers by either performing a PCA on them or by eliminating highly correlated ones.
raster.reduce(layers, method = "pca", n = NULL, thres = NULL)
raster.reduce(layers, method = "pca", n = NULL, thres = NULL)
layers |
Raster* object as defined by package raster. |
method |
Either Principal Components Analysis ("pca", default) or Pearson's correlation ("cor"). |
n |
Number of layers to reduce to. |
thres |
Value for pairwise Pearson's correlation above which one of the layers (randomly selected) is eliminated. |
Using a large number of explanatory variables in models with few records may lead to overfitting. This function allows to avoid it as much as possible. If both n and thres are given, n has priority. If method is not recognized and layers come from raster.read function, only landcover is reduced by using only the dominating landuse of each cell.
A RasterStack object.
Downloads species or higher taxon data from GBIF and outputs non-duplicate records with geographical coordinates.
records(taxon)
records(taxon)
taxon |
Taxon name. |
As always when using data from multiple sources the user should be careful and check if records "make sense". This can be done by either ploting them in a map (e.g. using red::map.draw()) or using red::outliers().
A data.frame with longitude and latitude, plus species names if taxon is above species.
rec = records("Nephila senegalensis") plot(rec)
rec = records("Nephila senegalensis") plot(rec)
Load data included in the package. This includes *red.records*, a matrix of longitude and latitude (two columns) occurrence records for Hogna maderiana (Walckenaer, 1837); *red.range*, a SpatRaster object, as defined by package terra, of the geographic range of Hogna maderiana (Walckenaer, 1837); *red.layers*, a SpatRaster object with layers representing the average annual temperature, total annual precipitation, altitude and landcover for Madeira Island (Fick & Hijmans 2017, Tuanmu & Jetz 2014); and *worldborders* is a small vector of global country borders.
red.examples(data = NULL)
red.examples(data = NULL)
data |
Name of data in quotes. E.g.: '"red.records"' If 'NULL', the example files will be listed. |
This function is inspired by 'palmerpanguins::path_to_file()' which in turn is based on 'readxl::readxl_example()'.
red.examples() red.examples("red.range")
red.examples() red.examples("red.range")
Read directory where GIS files are stored.
red.getDir()
red.getDir()
Reads a txt file pointing to where the world GIS files are stored.
Setup directory where GIS files are stored.
red.setDir(gisPath = NULL)
red.setDir(gisPath = NULL)
gisPath |
Path to the directory where the gis files are stored. |
Writes a txt file in the red directory allowing the package to always access the world GIS files directory.
Setup red to work with species distribution modelling and layers available online.
red.setup()
red.setup()
Please check that you have at least 50Gb free in your disk (and a fast internet connection) to download all files. In the end of the process "only" 17.4Gb will be left though. This function will: 1. Check if maxent.jar is available in the dismo package directory. 2. Ask user input for GIS directory. 3. Download global bioclim and elevation files (20) from http://biogeo.ucdavis.edu/data/worldclim/v2.0/tif/base/wc2.0_30s_bio.zip. 4. Download landcover files (12) from http://data.earthenv.org/consensus_landcover/without_DISCover/. 5. Unzip all files and delete the originals. 6. Create a new layer (1) with the dominant land cover at each cell. 7. Resample all files (33) to approximately 10x10km (for use with widespread species) grid cells. Sit back and enjoy, this should take a while.
Calculates the Red List Index (RLI) for a group of species.
rli(spData, tree = NULL, boot = FALSE, dd = FALSE, runs = 1000)
rli(spData, tree = NULL, boot = FALSE, dd = FALSE, runs = 1000)
spData |
Either a vector with species assessment categories for a single point in time or a matrix with two points in time in different columns (species x date). Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX). |
tree |
An hclust or phylo object (used when species are weighted by their unique contribution to phylogenetic or functional diversity). |
boot |
If TRUE bootstrapping for statistical significance is performed on both values per date and the trend between dates. |
dd |
bootstrap among all species (FALSE) or Data Deficient species only (TRUE). |
runs |
Number of runs for bootstrapping |
The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to Extinct/Extinct in the Wild (5). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Each species weight can further be influenced by how much it uniquely contributes to the phylogenetic or functional diversity of the group (Cardoso et al. in prep.). To incorporate Importantly, the RLI is based on true improvements or deteriorations in the status of species, i.e. genuine changes. It excludes category changes resulting from, e.g., new knowledge (Butchart et al. 2007). The RLI approach helps to develop a better understanding of which taxa, regions or ecosystems are declining or improving. Juslen et al. (2016a, b) suggested the use of bootstrapping to search for statistical significance when comparing taxa or for trends in time of the index and this approach is here implemented.
Either a vector (if no two dates are given) or a matrix with the RLI values and, if bootstrap is performed, their confidence limits and significance.
Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PloS Biology, 2: 2294-2304.
Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PloS One, 2: e140.
Juslen, A., Cardoso, P., Kullberg, J., Saari, S. & Kaila, L. (2016a) Trends of extinction risk for Lepidoptera in Finland: the first national Red List Index of butterflies and moths. Insect Conservation and Diversity, 9: 118-123.
Juslen, A., Pykala, J., Kuusela, S., Kaila, L., Kullberg, J., Mattila, J., Muona, J., Saari, S. & Cardoso, P. (2016b) Application of the Red List Index as an indicator of habitat change. Biodiversity and Conservation, 25: 569-585.
rliData <- matrix(c("LC","LC","EN","EN","EX","EX","LC","CR","DD","DD"), ncol = 2, byrow = TRUE) colnames(rliData) <- c("2000", "2010") rli(rliData[,1]) rli(rliData[,1], boot = TRUE) rli(rliData) rli(rliData, boot = TRUE, dd = TRUE)
rliData <- matrix(c("LC","LC","EN","EN","EX","EX","LC","CR","DD","DD"), ncol = 2, byrow = TRUE) colnames(rliData) <- c("2000", "2010") rli(rliData[,1]) rli(rliData[,1], boot = TRUE) rli(rliData) rli(rliData, boot = TRUE, dd = TRUE)
Creates a map for the red list index according to species distribution and threat status.
rli.map(spData, layers, layers2 = NULL, tree = NULL)
rli.map(spData, layers, layers2 = NULL, tree = NULL)
spData |
Either a vector with species assessment categories for a single point in time or a matrix with two points in time in different columns (species x date). Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX). |
layers |
Species distributions (0/1), a Raster* object as defined by package raster. |
layers2 |
Species distributions (0/1) on the second point in time, a Raster* object as defined by package raster. If there are two dates but no layers2, the distributions are assumed to be kept constant in time. |
tree |
An hclust or phylo object (used when species are weighted by their unique contribution to phylogenetic or functional diversity). |
The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to Extinct/Extinct in the Wild (5). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Each species weight can further be influenced by how much it uniquely contributes to the phylogenetic or functional diversity of the group (Cardoso et al. in prep.).
A RasterLayer with point values (if a single date is given) or change per cell (if two dates are given).
Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PloS Biology, 2: 2294-2304.
Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PloS One, 2: e140.
sp1 <- terra::rast(matrix(c(1,1,1,0,0,0,0,0,NA), ncol = 3)) sp2 <- terra::rast(matrix(c(1,0,0,1,0,0,1,0,NA), ncol = 3)) sp3 <- terra::rast(matrix(c(1,0,0,0,0,0,0,0,NA), ncol = 3)) sp4 <- terra::rast(matrix(c(0,1,1,1,1,1,1,1,NA), ncol = 3)) layers <- c(sp1, sp2, sp3, sp4) spData <- c("CR","EN","VU","LC") terra::plot(rli.map(spData, layers))
sp1 <- terra::rast(matrix(c(1,1,1,0,0,0,0,0,NA), ncol = 3)) sp2 <- terra::rast(matrix(c(1,0,0,1,0,0,1,0,NA), ncol = 3)) sp3 <- terra::rast(matrix(c(1,0,0,0,0,0,0,0,NA), ncol = 3)) sp4 <- terra::rast(matrix(c(0,1,1,1,1,1,1,1,NA), ncol = 3)) layers <- c(sp1, sp2, sp3, sp4) spData <- c("CR","EN","VU","LC") terra::plot(rli.map(spData, layers))
Calculates the Red List Index (RLI) for multiple groups of species.
rli.multi(spData, tree = NULL, boot = FALSE, dd = FALSE, runs = 1000)
rli.multi(spData, tree = NULL, boot = FALSE, dd = FALSE, runs = 1000)
spData |
A matrix with group names (first column) and species assessment categories for one or two points in time (remaining columns). Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX). |
tree |
A list of hclust or phylo objects, each corresponding to a tree per group (used when species are weighted by their unique contribution to phylogenetic or functional diversity). |
boot |
If TRUE bootstrapping for statistical significance is performed on both values per date and the trend between dates. |
dd |
bootstrap among all species (FALSE) or Data Deficient species only (TRUE). |
runs |
Number of runs for bootstrapping |
The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to 5 (Extinct/Extinct in the Wild). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Each species weight can further be influenced by how much it uniquely contributes to the phylogenetic or functional diversity of the group (Cardoso et al. in prep.). Importantly, the RLI is based on true improvements or deteriorations in the status of species, i.e. genuine changes. It excludes category changes resulting from, e.g., new knowledge (Butchart et al. 2007). The RLI approach helps to develop a better understanding of which taxa, regions or ecosystems are declining or improving. Juslen et al. (2016a, b) suggested the use of bootstrapping to search for statistical significance when comparing taxa or for trends in time of the index and this approach is here implemented.
A matrix with the RLI values and, if bootstrap is performed, their confidence limits and significance.
Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PloS Biology, 2: 2294-2304.
Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PloS One, 2: e140.
Juslen, A., Cardoso, P., Kullberg, J., Saari, S. & Kaila, L. (2016a) Trends of extinction risk for Lepidoptera in Finland: the first national Red List Index of butterflies and moths. Insect Conservation and Diversity, 9: 118-123.
Juslen, A., Pykala, J., Kuusela, S., Kaila, L., Kullberg, J., Mattila, J., Muona, J., Saari, S. & Cardoso, P. (2016b) Application of the Red List Index as an indicator of habitat change. Biodiversity and Conservation, 25: 569-585.
rliData <- matrix(c("LC","LC","EN","EN","EX","EX","LC","CR","CR","EX"), ncol = 2, byrow = TRUE) colnames(rliData) <- c("2000", "2010") rliData <- cbind(c("Arthropods","Arthropods","Birds","Birds","Birds"), rliData) rli.multi(rliData[,1:2]) rli.multi(rliData[,1:2], boot = TRUE) rli.multi(rliData) rli.multi(rliData, boot = TRUE)
rliData <- matrix(c("LC","LC","EN","EN","EX","EX","LC","CR","CR","EX"), ncol = 2, byrow = TRUE) colnames(rliData) <- c("2000", "2010") rliData <- cbind(c("Arthropods","Arthropods","Birds","Birds","Birds"), rliData) rli.multi(rliData[,1:2]) rli.multi(rliData[,1:2], boot = TRUE) rli.multi(rliData) rli.multi(rliData, boot = TRUE)
Linearly interpolates and extrapolates RLI values to any years.
rli.predict(rliValue, from = NA, to = NA, rliPlot = FALSE)
rli.predict(rliValue, from = NA, to = NA, rliPlot = FALSE)
rliValue |
Should be a vector with RLI values and names as the corresponding year numbers. |
from |
Starting year of the sequence to predict. |
to |
Ending year of the sequence to predict. |
rliPlot |
Plots the result |
The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa.
A matrix with the RLI values and confidence limits.
rliValue <- c(4.5, 4.3, 4.4, 4.2, 4.0) names(rliValue) <- c(2000, 2004, 2008, 2011, 2017) rli.predict(rliValue, 1990, 2020)
rliValue <- c(4.5, 4.3, 4.4, 4.2, 4.0) names(rliValue) <- c(2000, 2004, 2008, 2011, 2017) rli.predict(rliValue, 1990, 2020)
Calculates accumulation curve of confidence limits in sampled RLI.
rli.sampled(spData, tree = NULL, p = 0.05, runs = 1000)
rli.sampled(spData, tree = NULL, p = 0.05, runs = 1000)
spData |
A vector with species assessment categories for a single point in time. Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX). |
tree |
An hclust or phylo object (used when species are weighted by their unique contribution to phylogenetic or functional diversity). |
p |
p-value of confidence limits (in a two-tailed test). |
runs |
Number of runs for smoothing accumulation curves. |
The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to Extinct/Extinct in the Wild (5). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Yet, in many groups, it is not possible to assess all species due to huge diversity and/or lack of resources. In such case, the RLI is estimated from a randomly selected sample of species - the Sampled Red List Index (SRLI; Stuart et al. 2010). This function allows to calculate how many species are needed to reach a given maximum error of the SRLI around the true value of the RLI (with all species included) for future assessments of the group.
A vector with the accumulation of the error of the SRLI around the true value of the RLI (with all species included).
Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PLoS Biology, 2: 2294-2304.
Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PLoS One, 2: e140.
Stuart, S.N., Wilson, E.O., McNeely, J.A., Mittermeier, R.A. & Rodriguez, J.P. (2010) The barometer of Life. Science 328, 117.
rliData <- c("LC","LC","EN","EN","EX","EX","LC","CR","CR","EX") rli.sampled(rliData)
rliData <- c("LC","LC","EN","EN","EX","EX","LC","CR","CR","EX") rli.sampled(rliData)
Thinning of records with minimum distances either absolute or relative to the species range.
thin(longlat, distance = 0.01, relative = TRUE, runs = 100)
thin(longlat, distance = 0.01, relative = TRUE, runs = 100)
longlat |
Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records. |
distance |
Distance either in relative terms (proportion of maximum distance between any two records) or in raster units. |
relative |
If TRUE, represents the proportion of maximum distance between any two records. If FALSE, is in raster units. |
runs |
Number of runs |
Clumped distribution records due to ease of accessibility of sites, emphasis of sampling on certain areas in the past, etc. may bias species distribution models. The algorithm used here eliminates records closer than a given distance to any other record. The choice of records to eliminate is random, so a number of runs are made and the one keeping more of the original records is chosen.
A matrix of species occurrence records separated by at least the given distance.
records <- matrix(sample(100), ncol = 2) par(mfrow=c(1,2)) graphics::plot(records) records <- thin(records, 0.1) graphics::plot(records)
records <- matrix(sample(100), ncol = 2) par(mfrow=c(1,2)) graphics::plot(records) records <- thin(records, 0.1) graphics::plot(records)