Retrieve Vernacular (Common) Names for Species
Source:R/get_vernacularname.R
get_iucn_common_name.RdThis function retrieves vernacular (common) names for species using IUCN data.
It filters vernacular names based on the taxonID and merges them
with species metadata. The output can be customized as either a vector of common names
or a tibble containing detailed information.
Arguments
- splist
A character vector containing the scientific names of species for which vernacular names are to be retrieved.
- format
A character string specifying the output format. Options are:
"vect": Returns a vector of common names."tbl": Returns a tibble with species details and their vernacular names. Default is"tbl".
Value
Depending on the format argument:
If
"vect", a character vector of common names.If
"tbl", a tibble with the following columns:- submitted_name
The scientific name of the species as submitted.
- matched_species
The matched species name from IUCN data.
- common_name
The vernacular (common) name. If no common name is found, it returns
"---".
Examples
species <- c("Panthera uncia", "Cedrela odorata")
result <- get_iucn_common_name(splist = species, format = "tbl")
#>
#> ── Matching names to IUCN genus list ───────────────────────────────────────────
#> ✔ All input genera were matched successfully (2 exact, 0 fuzzy).
#>
#> ── Matching names to IUCN species list ─────────────────────────────────────────
#> ✔ All species were matched successfully (2 exact, 0 fuzzy).
#>
#> ── Verifying IUCN data for common names. ───────────────────────────────────────
print(result)
#> # A tibble: 2 × 4
#> id submitted_name matched_species common_name
#> <int> <chr> <chr> <chr>
#> 1 1 Panthera uncia Panthera uncia Snow Leopard
#> 2 2 Cedrela odorata Cedrela odorata Spanish Cedar
common_names <- get_iucn_common_name(splist = species, format = "vect")
#>
#> ── Matching names to IUCN genus list ───────────────────────────────────────────
#> ✔ All input genera were matched successfully (2 exact, 0 fuzzy).
#>
#> ── Matching names to IUCN species list ─────────────────────────────────────────
#> ✔ All species were matched successfully (2 exact, 0 fuzzy).
#>
#> ── Verifying IUCN data for common names. ───────────────────────────────────────
print(common_names)
#> [1] "Snow Leopard" "Spanish Cedar"