Add one or more rows to a taxonomic database in Darwin Core (DwC) format.
Usage
dct_add_row(
tax_dat,
taxonID = NULL,
scientificName = NULL,
taxonomicStatus = NULL,
acceptedNameUsageID = NULL,
acceptedNameUsage = NULL,
new_dat = NULL,
fill_taxon_id = dct_options()$fill_taxon_id,
fill_usage_id = dct_options()$fill_usage_id,
taxon_id_length = dct_options()$taxon_id_length,
stamp_modified = dct_options()$stamp_modified,
strict = dct_options()$strict,
...
)
Arguments
- tax_dat
Dataframe; taxonomic database in DwC format.
- taxonID
Character or numeric vector; values to add to taxonID column. Ignored if
new_dat
is notNULL
.- scientificName
Character vector; values to add to scientificName column. Ignored if
new_dat
is notNULL
.- taxonomicStatus
Character vector; values to add to taxonomicStatus column. Ignored if
new_dat
is notNULL
.- acceptedNameUsageID
Character or numeric vector; values to add to acceptedNameUsageID column. Ignored if
new_dat
is notNULL
.- acceptedNameUsage
Character vector; values to add to acceptedNameUsage column. Ignored if
new_dat
is notNULL
.- new_dat
A dataframe including columns corresponding to one or more of the above arguments, except for
tax_dat
. Other DwC terms can also be included as additional columns. All rows innew_dat
will be appended to the input data (tax_dat
).- fill_taxon_id
Logical vector of length 1; if
taxon_id
is not provided, should values in the taxonID column be filled in by generating them automatically from the scientificName? If thetaxonID
column does not yet exist it will be created. DefaultTRUE
.- fill_usage_id
Logical vector of length 1; if
usage_id
is not provided, should values in the acceptedNameUsageID column be filled in by matching acceptedNameUsage to scientificName? If theacceptedNameUsageID
column does not yet exist it will be created. DefaultTRUE
.- taxon_id_length
Numeric vector of length 1; how many characters should be included in automatically generated values of taxonID? Must be between 1 and 32, inclusive. Default
32
.- stamp_modified
Logical vector of length 1; should the
modified
column of any newly created or modified row include a timestamp with the date and time of its creation/modification? If themodified
column does not yet exist it will be created. DefaultTRUE
.- strict
Logical vector of length 1; should taxonomic checks be run on the updated taxonomic database? Default
FALSE
.- ...
Additional data to add, specified as sets of named character or numeric vectors; e.g.,
parentNameUsageID = "6SH4"
. The name of each must be a valid column name for data in DwC format. Ignored ifnew_dat
is notNULL
.
Details
fill_taxon_id
and fill_usage_id
only act on the newly added data (they
do not fill columns in tax_dat
).
If "taxonID" is not provided for the new row and fill_taxon_id
is TRUE
,
a value for taxonID will be automatically generated from the md5 hash digest
of the scientific name.
To modify settings used for validation if strict
is TRUE
,
use dct_options()
.
Examples
tibble::tibble(
taxonID = "123",
scientificName = "Foogenus barspecies",
acceptedNameUsageID = NA_character_,
taxonomicStatus = "accepted"
) |>
dct_add_row(
scientificName = "Foogenus barspecies var. bla",
parentNameUsageID = "123",
nameAccordingTo = "me",
strict = TRUE
)
#> # A tibble: 2 × 7
#> taxonID scientificName acceptedNameUsageID taxonomicStatus parentNameUsageID
#> <chr> <chr> <chr> <chr> <chr>
#> 1 123 Foogenus bars… NA accepted NA
#> 2 cfedfbbb… Foogenus bars… NA NA 123
#> # ℹ 2 more variables: nameAccordingTo <chr>, modified <chr>