Removes or flags records outside of the provided natural range polygon, on a per species basis. Expects one entry per species. See the example or https://www.iucnredlist.org/resources/spatial-data-download for the required polygon structure.
cc_iucn( x, range, lon ="decimalLongitude", lat ="decimalLatitude", species ="species", buffer =0, value ="clean", verbose =TRUE)
Arguments
x: data.frame. Containing geographical coordinates and species names.
range: a SpatVector of natural ranges for species in x. Must contain a column named as indicated by species. See details.
lon: character string. The column with the longitude coordinates. Default = decimalLongitude .
lat: character string. The column with the latitude coordinates. Default = decimalLatitude .
species: a character string. The column with the species name. Default = species .
buffer: numerical. The buffer around each species' range, from where records should be flagged as problematic, in meters. Default = 0.
value: character string. Defining the output value. See value.
verbose: logical. If TRUE reports the name of the test and the number of records flagged.
Returns
Depending on the value argument, either a data.frame
containing the records considered correct by the test (clean ) or a logical vector (flagged ), with TRUE = test passed and FALSE = test failed/potentially problematic . Default = clean .
Details
Download natural range maps in suitable format for amphibians, birds, mammals and reptiles from https://www.iucnredlist.org/resources/spatial-data-download. Note: the buffer radius is in degrees, thus will differ slightly between different latitudes.