Format fields that contain taxonomic name information from kingdom to
species, as well as the common/vernacular name, to a tibble
using
Darwin Core Standard.
In practice this is no different from using mutate()
, but gives some
informative errors, and serves as a useful lookup for accepted column names in
the Darwin Core Standard.
Usage
set_taxonomy(
.df,
kingdom = NULL,
phylum = NULL,
class = NULL,
order = NULL,
family = NULL,
genus = NULL,
specificEpithet = NULL,
vernacularName = NULL,
.keep = "unused"
)
Arguments
- .df
A
data.frame
ortibble
that the column should be appended to.- kingdom
The kingdom name of identified taxon.
- phylum
The phylum name of identified taxon.
- class
The class name of identified taxon.
- order
The order name of identified taxon.
- family
The family name of identified taxon.
- genus
The genus name of the identified taxon.
- specificEpithet
The name of the first species or species epithet of the
scientificName
. See documentation- vernacularName
The common or vernacular name of the identified taxon.
- .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
Examples of specificEphithet
:
If
scientificName
isAbies concolor
, thespecificEpithet
isconcolor
.If
scientificName
isSemisulcospira gottschei
, thespecificEpithet
isgottschei
.
See also
set_scientific_name()
for adding scientificName
and authorship information.
Examples
df <- tibble::tibble(
scientificName = c("Crinia Signifera", "Crinia Signifera", "Litoria peronii"),
fam = c("Myobatrachidae", "Myobatrachidae", "Hylidae"),
ord = c("Anura", "Anura", "Anura"),
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 terms
df |>
set_scientific_name(
scientificName = scientificName
) |>
set_taxonomy(
family = fam,
order = ord
)
#> ⠙ Checking 1 column: scientificName
#> ✔ Checking 1 column: scientificName [310ms]
#>
#> ⠙ Checking 2 columns: family and order
#> ✔ Checking 2 columns: family and order [617ms]
#>
#> # A tibble: 3 × 6
#> scientificName latitude longitude eventDate family order
#> <chr> <dbl> <dbl> <chr> <chr> <chr>
#> 1 Crinia Signifera -35.3 149. 2010-10-14 Myobatrachidae Anura
#> 2 Crinia Signifera -35.2 149. 2010-10-14 Myobatrachidae Anura
#> 3 Litoria peronii -35.8 149. 2010-10-14 Hylidae Anura