Flags records that fall outside every range polygon of their species, for
example an IUCN range map. The polygons come from gazetteers = list(range = <sf>): an sf object with a species column (named like the record's
species column, species, binomial or sci_name). Species without a
polygon are not tested. With buffers = list(range = m), records within
m metres of a polygon edge count as inside.
Arguments
- x
A data frame of occurrence records.
- ranges
Species range polygons, as
gazetteers = list(range = ...)inflag_occurrences().- buffer
Buffer distance of the test, in the unit of its Buffer section; the default is the test's default buffer.
- ...
Further arguments to
flag_occurrences():columns,reference,gazetteers,land_scale.
Value
clean_<test>(): the rows of x the test does not flag, with the
columns of x unchanged. See keep_unflagged(), Cleaning functions.
Buffer
buffers = list(range = 0), in metres. The distance to an
edge is measured on the ellipsoid from the closest point of the edge in a
local equirectangular projection.
CoordinateCleaner
Equivalent to cc_iucn(); identical flags
without a buffer. With a buffer CoordinateCleaner buffers the polygons
with terra, so records very close to the buffer edge may differ.
See also
flag_occurrences(), flag_tests()
Other tests:
clean_age_equal(),
clean_age_outlier(),
clean_age_range_outlier(),
clean_aohi(),
clean_basis_fossil(),
clean_capital(),
clean_centroid(),
clean_country_mismatch(),
clean_dataset_ddmm(),
clean_dataset_rounded(),
clean_duplicate(),
clean_equal(),
clean_establishment_introduced(),
clean_gbif_headquarters(),
clean_institution(),
clean_invalid(),
clean_issue_coordinate(),
clean_outlier(),
clean_sea(),
clean_sea_nonmarine(),
clean_spatiotemporal_outlier(),
clean_urban(),
clean_zero()
Examples
if (requireNamespace("sf", quietly = TRUE)) {
rg <- sf::st_sf(species = "a", geometry = sf::st_sfc(sf::st_polygon(list(
rbind(c(0, 40), c(20, 40), c(20, 55), c(0, 55), c(0, 40)))), crs = 4326))
x <- data.frame(species = c("a", "a", "b"), decimalLongitude = c(10, 30, 30),
decimalLatitude = 50)
flag_occurrences(x, tests = "range", gazetteers = list(range = rg))$flag_range
clean_range(x, ranges = rg)
}