
Set, create or modify columns with scientific name & authorship information
Source:R/set_scientific_name.R
set_scientific_name.RdFormat the field scientificName, the lowest identified taxonomic name of an
occurrence, along with the rank and authorship of the provided name to a
tibble using Darwin Core Standard.
Usage
set_scientific_name(
.df,
scientificName = NULL,
scientificNameAuthorship = NULL,
taxonRank = NULL,
.keep = "unused"
)Arguments
- .df
A
data.frameortibblethat the column should be appended to.- scientificName
The full scientific name in the lower level taxonomic rank that can be determined.
The authorship information for
scientificName.- taxonRank
The taxonomic rank of
scientificName.- .keep
Control which columns from .data are retained in the output. Note that unlike
dplyr::mutate(), which defaults to"all"this defaults to"unused"; i.e. only keeps Darwin Core columns, and not those columns used to generate them.
Details
In practice this function is used no differently from mutate(), but gives
users some informative errors, and serves as a useful lookup for accepted
column names in the Darwin Core Standard.
Examples of scientificName values (we specify the rank in parentheses, but
users should not include this information):
Coleoptera(order)Vespertilionidae(family)Manis(genus)Ctenomys sociabilis(genus + specificEpithet)Ambystoma tigrinum diaboli(genus + specificEpithet + infraspecificEpithet)
Examples of scientificNameAuthorship:
(Györfi, 1952)R. A. Graham(Martinovský) Tzvelev
Examples of taxonRank:
ordergenussubspeciesinfraspecies
See also
set_taxonomy() for taxonomic name information.
Examples
df <- tibble::tibble(
name = c("Crinia Signifera", "Crinia Signifera", "Litoria peronii"),
latitude = c(-35.27, -35.24, -35.83),
longitude = c(149.33, 149.34, 149.34),
eventDate = c("2010-10-14", "2010-10-14", "2010-10-14")
)
# Reformat columns to Darwin Core Standard terms
df |>
set_scientific_name(
scientificName = name
)
#> ⠙ Checking 1 column: scientificName
#> ✔ Checking 1 column: scientificName [311ms]
#>
#> # A tibble: 3 × 4
#> latitude longitude eventDate scientificName
#> <dbl> <dbl> <chr> <chr>
#> 1 -35.3 149. 2010-10-14 Crinia Signifera
#> 2 -35.2 149. 2010-10-14 Crinia Signifera
#> 3 -35.8 149. 2010-10-14 Litoria peronii