dct_options {dwctaxon} | R Documentation |
Get and set function arguments via options
Description
Changes the default values of function arguments.
Usage
dct_options(reset = FALSE, ...)
Arguments
reset |
Logical vector of length 1; if TRUE, reset all options to their default values. |
... |
Any number of |
Details
Use this to change the default values of function arguments. That way, you don't have to type the same thing each time you call a function.
The arguments that can be set with this function are as follows:
Validation arguments
-
check_col_names
: Logical vector of length 1; should all column names be required to be a valid DwC term? DefaultTRUE
. -
check_mapping_accepted_status
: Logical vector of length 1; should rules about mapping of variants and synonyms be enforced? DefaultFALSE
. (Seedct_validate()
). -
check_mapping_accepted
: Logical vector of length 1; should all values ofacceptedNameUsageID
be required to map to thetaxonID
of an existing name? DefaultTRUE
. -
check_mapping_original
: Logical vector of length 1; should all values oforiginalNameUsageID
be required to map to thetaxonID
of an existing name? DefaultTRUE
. -
check_mapping_parent
: Logical vector of length 1; should all values ofparentNameUsageID
be required to map to thetaxonID
of an existing name? DefaultTRUE
. -
check_sci_name
: Logical vector of length 1; should all instances ofscientificName
be required to be non-missing and unique? DefaultTRUE
. -
check_status_diff
: Logical vector of length 1; should each scientific name be allowed to have only one taxonomic status? DefaultFALSE
. -
check_tax_status
: Logical vector of length 1; should all taxonomic names be required to have a valid value for taxonomic status (by default, "accepted", "synonym", or "variant")? DefaultTRUE
. -
check_taxon_id
: Logical vector of length 1; should all instances oftaxonID
be required to be non-missing and unique? DefaultTRUE
. -
extra_cols
: Character vector; names of columns that should be allowed beyond those defined by the DwC taxon standard. Default NULL. Providing column name(s) that are valid DwC taxon column(s) has no effect. -
on_fail
: Character vector of length 1, either "error" or "summary". Describes what to do if the check fails. Default"error"
. -
on_success
: Character vector of length 1, either "logical" or "data". Describes what to do if the check passes. Default"data"
. -
skip_missing_cols
: Logical vector of length 1; should checks be silently skipped if any of the columns they inspect are missing? DefaultFALSE
. -
valid_tax_status
: Character vector of length 1; valid values fortaxonomicStatus
. Each value must be separated by a comma. Defaultaccepted, synonym, variant, NA
."NA"
indicates that missing (NA) values are valid. Case-sensitive.
Editing arguments
-
clear_usage_id
: Logical vector of length 1; should acceptedNameUsageID of the selected row be set toNA
if the word "accepted" is detected in tax_status (not case-sensitive)? DefaultTRUE
. -
clear_usage_name
: Logical vector of length 1; should acceptedNameUsage of the selected row be set toNA
if the word "accepted" is detected in tax_status (not case-sensitive)? DefaultTRUE
. -
fill_taxon_id
: Logical vector of length 1; iftaxon_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; ifusage_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
. -
fill_usage_name
: Logical vector of length 1; should the acceptedNameUsage of the selected row be set to the scientificName corresponding to its acceptedNameUsageID? DefaultTRUE
. -
remap_names
: Logical vector of length 1; should the acceptedNameUsageID be updated (remapped) for rows with the same acceptedNameUsageID as the taxonID of the row to be modified? DefaultTRUE
. -
remap_variant
: Same asremap_names
, but applies specifically to rows with taxonomicStatus of "variant". DefaultFALSE
. -
stamp_modified
: Logical vector of length 1; should themodified
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
. -
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. Default32
.
General arguments
-
quiet
: Logical vector of length 1; should warnings be silenced? DefaultFALSE
. -
strict
: Logical vector of length 1; should taxonomic checks be run on the updated taxonomic database? DefaultFALSE
.
Value
Nothing; used for its side-effect.
Examples
# Show all options
dct_options()
# Store existing settings, including any changes made by the user
old_settings <- dct_options()
# View one option
dct_options()$valid_tax_status
# Change one option
dct_options(valid_tax_status = "accepted, weird, whatever")
dct_options()$valid_tax_status
# Reset to default values
dct_options(reset = TRUE)
dct_options()$valid_tax_status
# Multiple options may also be set at once
dct_options(check_taxon_id = FALSE, check_status_diff = TRUE)
# Reset options to those before this example was run
do.call(dct_options, old_settings)