std_collection

Standardize Herbarium Acronyms in Collection Records
barRoso::std_collection()

Description

Cleans and standardizes herbarium acronyms in biodiversity datasets by harmonizing values from the collectionCode and institutionCode fields. The function corrects common issues in GBIF and other aggregated records, replacing ambiguous or placeholder codes with the herbarium acronyms of Index Herbariorum.

Details

This function is part of the barRoso package. Instead of a dictionary of every code, it uses regular expressions that generalize across datasets, in the following order:

  • Aggregated collections like "Tropicos" or "MO-Duplicates" are replaced with the herbarium of the specimen given in institutionCode (e.g. "NY"), or with "MO" when it is missing.
  • Generic words like "Botany", "Herbarium", "Vascular Plants" or "PNGplants" are replaced with the acronym in institutionCode or, when missing, with the acronym at the beginning of catalogNumber (e.g. "U.1317533" into "U") or in occurrenceID (e.g. "urn:catalog:INB:...").
  • Names of collections, like "F-Seedplants", "BHCB-Fanerogamas", "INPA-Carpoteca", "R-Tipos", "UIS-H" or "BSMvplantscoll", are reduced to the herbarium acronym. Codes of wood collections, like "INPAw", are kept, as they are Index Herbariorum codes.
  • Names of herbaria and institutions, like "Herbario INPA", "Herbario Nacional de Costa Rica (CR)" or "Instituto de Botanica de Sao Paulo", are replaced with the acronym given in the name or with the known acronym.
  • Codes that are not acronyms, like observation projects ("Observations", "Dados de Pesquisa SISBio"), companies ("Ecopetrol S.A") or numbers, are replaced with the acronym in institutionCode or catalogNumber, or with NA.

The columns catalogNumber and occurrenceID are used when present.

Arguments

Argument Description
df A data frame with biodiversity specimen records.
colname_collectionCode Name of the column containing collection codes (default: "collectionCode").
colname_institutionCode Name of the column containing institution codes (default: "institutionCode").
rm_original_column Logical; if TRUE, original columns are removed after cleaning (default: TRUE).

Value

A data frame with standardized collection codes in the collectionCode column. If rm_original_column = FALSE, the original values are saved with a *Original suffix.

Examples

df <- data.frame(collectionCode = c("Tropicos", "Botany", "F-Seedplants",
                                    "Herbario INPA", "Observations"),
                 institutionCode = c("NY", NA, "F", "INPA", "iNaturalist"),
                 catalogNumber = c("100595392", "U.1317533", "V0059731F",
                                   "123", "340214363"))
std_collection(df)$collectionCode