barRoso::barroso_cat()barroso_cat
Description
Merges herbarium records from two or more biodiversity data sources into a single harmonized data frame. Optionally prioritizes specific sources when duplicates are detected across herbaria, retaining records based on a flexible exclusion strategy.
Details
This function aligns column structures, removes redundant records from overlapping herbaria, and merges all sources into a single output. Duplicate filtering is based on matching collectionCode across sources: when keep_source is given, the records of any herbarium that is also present in keep_source are removed from the other sources. Herbaria shared only among the other sources are kept.
Each source is first formatted into Darwin Core column names and values with barroso_dwc(), e.g. the columns of speciesLink downloads (collector, collectornumber, recordedby) are renamed into recordedBy and recordNumber, and the dates and type status of REFLORA and JABOT records are standardized. The sources are recognized by their content, so their names in list_sources can be any name.
Columns with different types across sources (e.g. numeric year in one source and character in another) are combined as character. A column datasource records the source of each record.
Arguments
| Argument | Description |
|---|---|
| list_sources | A named list of data frames. Each element represents a herbarium data source. The names of the list are used to track the source origin for internal filtering. |
| keep_source | Optional character string specifying the preferred data source (e.g., “GBIF”) for resolving duplicate collectionCode conflicts. If NULL, all records are retained. |
Value
A harmonized data frame combining all provided herbarium sources, with columns aligned, a datasource column, and optionally filtered to resolve duplicate collections.
Examples
reflora <- refloraR::reflora_records(herbarium = "RB", taxon = "Ormosia", save = FALSE)
jabot <- jabotR::jabot_records(herbarium = "MBM", taxon = "Ormosia", save = FALSE)
combined_df <- barroso_cat(list_sources = list(GBIF = gbif_data,
speciesLink = splink_data,
REFLORA = reflora,
JABOT = jabot),
keep_source = "GBIF")