Skip to contents

filter_occurrences() tests many things about a record, but not whether its name is right, and different cleaning pipelines lead to different downstream conclusions (Fuehrding-Potschkat et al. 2022; Van Eupen et al. 2021). Records of a species in GBIF arrive under synonyms, outdated names, misspellings, genus-only or aggregate names, hybrid formulas and infraspecific names; checking them against a backbone and keeping only records that can be assigned confidently to the accepted taxon is part of a transparent cleaning workflow (Lipinski 2026). match_names() resolves every distinct name once and adds the result to each record; the name tests of filter_occurrences() (name_unmatched, name_synonym_conflict, rank_conflict) then use it.

Usage

match_names(
  x,
  name_col = NULL,
  backbone = "gbif",
  kingdom = NULL,
  checklist = NULL,
  max_dist = 2,
  cache = TRUE,
  cache_file = NULL,
  verbose = TRUE
)

Arguments

x

Occurrence records: a data.frame (e.g. from read_gbif() or merge_occurrences()) or a path to a GBIF download.

name_col

Column with the names. Default: the first of verbatimScientificName (the name as recorded, in GBIF downloads), scientificName, species and taxon that exists. In GBIF downloads scientificName and species were already matched by GBIF; matching the verbatim name shows what that interpretation did.

backbone

"gbif", "checklistbank" or a Darwin Core taxon table (data.frame or file) with taxonID, scientificName, taxonRank, taxonomicStatus and acceptedNameUsageID (and optionally parentNameUsageID, genus, specificEpithet, infraspecificEpithet).

kingdom

Optional kingdom, which avoids homonyms between plants and animals (e.g. "Plantae"); GBIF only.

checklist

A GBIF checklist key (rgbif 3.9 or later) or a ChecklistBank dataset key; NULL for the default of each service.

max_dist

Largest number of edited characters for a fuzzy match to a local table (at most a tenth of the name is also required).

cache

Keep the results of online look-ups for the session.

cache_file

Optional RDS file to keep them across sessions.

verbose

Print a summary.

Value

x with the name_* columns added. attr(, "names_matched") holds one row per distinct name.

Details

Backbones

  • "gbif" (default): the GBIF name matching service through the rgbif package (rgbif::name_backbone_checklist()); with rgbif 3.9 or later another checklist can be chosen with checklist (a GBIF checklist key).

  • "checklistbank": a dataset of ChecklistBank (default "3LR", the latest Catalogue of Life release) through its name-match API; needs the jsonlite package.

  • A Darwin Core taxon table (data.frame or path): e.g. the World Flora Online backbone (classification.csv, from WorldFlora::WFO.download()), a GBIF backbone Taxon.tsv, or your own checklist. Matched locally, without internet.

What is returned for each record

  • name_query: the name looked up (from name_col).

  • name_matched: the backbone name it matched, without authorship.

  • name_accepted, name_accepted_species: the accepted name (a synonym is followed to it) and its species (for infraspecific taxa).

  • name_rank, name_status: rank and status of the matched name.

  • name_match_type: "exact", "fuzzy" (the matched name is spelled differently from the query), "higherrank" (only a higher taxon, e.g. the genus, was found) or "none".

  • name_confidence: the backbone's confidence (0-100; GBIF), or, for a local table, 100 minus the share of edited characters (NA for ChecklistBank, which does not report one).

  • Flags: name_synonym, name_hybrid (a hybrid formula or nothotaxon, from the name), name_aggregate (an aggregate, agg. or s.l.), name_higherrank, name_fuzzy and name_unmatched.

Cache. Names are looked up once per distinct name; results are kept for the R session and, with cache_file, in an RDS file, so that repeated runs over a large download do not query the service again.

References

Fuehrding-Potschkat, P., Kreft, H., Ickert-Bond, S.M. (2022) Influence of different data cleaning solutions of point-occurrence records on downstream macroecological diversity models. Ecology and Evolution 12, e9168. doi:10.1002/ece3.9168

Van Eupen, C., Maes, D., Herremans, M., Swinnen, K.R.R., Somers, B., Luca, S. (2021) The impact of data quality filtering of opportunistic citizen science data on species distribution model performance. Ecological Modelling 444, 109453. doi:10.1016/j.ecolmodel.2021.109453

Lipinski, S. (2026) Spatial bias in open biodiversity data: how GBIF record quality shapes conservation analyses. Conservation 6, 40. doi:10.3390/conservation6020040

Examples

# a small local backbone in Darwin Core form
bb <- data.frame(
  taxonID = c("1", "2", "3", "4", "5"),
  scientificName = c("Aus bus L.", "Aus cus Mill.", "Aus dus Sm.",
                     "Aus bus subsp. eus Hook.", "Aus"),
  taxonRank = c("species", "species", "species", "subspecies", "genus"),
  taxonomicStatus = c("accepted", "accepted", "synonym", "accepted",
                      "accepted"),
  acceptedNameUsageID = c("", "", "1", "", ""),
  parentNameUsageID = c("5", "5", "", "1", ""))
occ <- data.frame(lon = 1:5, lat = 50,
                  scientificName = c("Aus bus", "Aus dus", "Aus buss",
                                     "Aus sp.", "Aus bus subsp. eus"))
m <- match_names(occ, backbone = bb)
#> Names matched (local): 5 records, 5 distinct names. Exact: 4 records; fuzzy (spelled differently, check them): 1; synonyms resolved to an accepted name: 1; only a higher rank found: 0; not found: 0; hybrid names: 0; aggregates: 0. Accepted species: Aus bus (4).
m[, c("name_query", "name_accepted", "name_match_type", "name_rank")]
#>           name_query name_accepted name_match_type  name_rank
#> 1            Aus bus       Aus bus           exact    species
#> 2            Aus dus       Aus bus           exact    species
#> 3           Aus buss       Aus bus           fuzzy    species
#> 4            Aus sp.           Aus           exact      genus
#> 5 Aus bus subsp. eus   Aus bus eus           exact subspecies
# \donttest{
# GBIF (needs rgbif and internet)
if (requireNamespace("rgbif", quietly = TRUE)) {
  match_names(data.frame(species = "Potentilla tabernaemontani"),
              kingdom = "Plantae")
}
#> Names matched (gbif): 1 records, 1 distinct names. Exact: 1 records; fuzzy (spelled differently, check them): 0; synonyms resolved to an accepted name: 1; only a higher rank found: 0; not found: 0; hybrid names: 0; aggregates: 0. Accepted species: Potentilla verna (1).
#>                      species                 name_query
#> 1 Potentilla tabernaemontani Potentilla tabernaemontani
#>                 name_matched    name_accepted name_accepted_species name_rank
#> 1 Potentilla tabernaemontani Potentilla verna      Potentilla verna   species
#>   name_status name_match_type name_confidence name_synonym name_hybrid
#> 1     synonym           exact             100         TRUE       FALSE
#>   name_aggregate name_higherrank name_fuzzy name_unmatched
#> 1          FALSE           FALSE      FALSE          FALSE
# }