Check if a GPS point is within an ecoregion where the species is present
Source:R/tax_check_ecoregion.R
tax_check_ecoregion.RdThis function determines whether a given GPS point falls within an ecoregion where a species has been observed, using GBIF occurrence data and WWF ecoregion data.
Usage
tax_check_ecoregion(
taxa_name,
longitudes = NULL,
latitudes = NULL,
n_occur = 500,
min_proportion = 0,
min_nb_occur = 0,
verbose = TRUE
)Arguments
- taxa_name
(character) Scientific name of the species to check.
- longitudes
(numeric vector) Longitude of the points to test
- latitudes
(numeric vector) Latitude of the points to test
- n_occur
numeric (default: 500) Maximum number of occurrences to retrieve from GBIF
- min_proportion
numeric (default: 0) Minimum proportion of occurrences in an ecoregion for it to be considered part of the species range (0 to 1). Note that min_proportion and min_nb_occur are combined (AND operator) when both are used.
- min_nb_occur
numeric (default: 0) Minimum number of occurrences in an ecoregion for it to be considered part of the species range. Note that min_proportion and min_nb_occur are combined (AND operator) when both are used.
- verbose
logical (default: TRUE) Whether to print progress messages
Value
A list containing: - ecoregion: A named vector with the number of occurrences in each ecoregion for the species - points_ecoregion: A vector with the ecoregion of each tested GPS point - is_in_ecoregion: TRUE if at least `min_nb_occur` of the tested GPS points falls within an ecoregion where the species has occurrences, FALSE otherwise
Details
The function: 1. Extracts ecoregions from species occurrences 2. Determines the ecoregion of the tested GPS point 3. Checks if this ecoregion matches those of the species
Examples
if (FALSE) { # \dontrun{
# Get occurrences
requireNamespace("rgbif")
tax_check_ecoregion("Xylobolus subpileatus",
longitudes = c(2.3522, 4.2),
latitudes = c(48.8566, 33)
)
xylo_ecoregion <- tax_check_ecoregion("Xylobolus subpileatus",
longitudes = c(2.3522, 4.2), latitudes = c(48.8566, 33),
n_occur = 20
)
} # }