Flags records whose coordinates fall outside the Natural Earth 1:50 million
country polygon named by their country code. The code is compared with the
polygon's ISO 3166-1 alpha-2 code, its alpha-3 code and the Natural Earth
ADM0_A3 code, case-insensitively. Records without a code, and records at
sea, are flagged.
Arguments
- x
A data frame of occurrence records.
- ...
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.
CoordinateCleaner
Equivalent to cc_coun(), which compares
alpha-3 codes only; for alpha-3 codes present in Natural Earth the flags
are identical. GBIF's countryCode is alpha-2 and works here without
conversion.
Custom gazetteer
gazetteers = list(country_mismatch = polygons), an sf or
sfc object of country polygons with a code column; see flag_occurrences().
See also
flag_occurrences(), flag_tests(), occ_columns()
Other tests:
clean_age_equal(),
clean_age_outlier(),
clean_age_range_outlier(),
clean_aohi(),
clean_basis_fossil(),
clean_capital(),
clean_centroid(),
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_range(),
clean_sea(),
clean_sea_nonmarine(),
clean_spatiotemporal_outlier(),
clean_urban(),
clean_zero()
Examples
x <- data.frame(decimalLongitude = 16.37, decimalLatitude = 48.21,
countryCode = c("AT", "AUT", "DE", NA))
flag_occurrences(x, tests = "country_mismatch")$flag_country_mismatch
clean_country_mismatch(x)