Changes the default values of function arguments.
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_mapping_parent_accepted
: Logical vector of length 1; should all values ofparentNameUsageID
be required to map to thetaxonID
of an accepted name? DefaultFALSE
.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_parent
: Logical vector of length 1; should the parentNameUsageID be updated (remapped) to that of its accepted name if it is a synonym? Will also apply to any other rows with the same parentNameUsageID 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
.stamp_modified_by
: Logical vector of length 1; should themodifiedBy
column of any newly created or modified row include the name of the current user? If themodifiedBy
column does not yet exist it will be created; note that this is a non-DWC standard column, so"modifiedBy"
is required inextra_cols
. The current user can be specified with theuser_name
option. DefaultFALSE
.stamp_modified_by_id
: Logical vector of length 1; should themodifiedByID
column of any newly created or modified row include the ID of the current user? If themodifiedByID
column does not yet exist it will be created; note that this is a non-DWC standard column, so"modifiedByID"
is required inextra_cols
. The current user ID can be specified with theuser_id
option. DefaultFALSE
.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
.user_name
: Character vector of length 1; the name of the current user. Default""
.user_id
: Character vector of length 1; the ID of the current user. Default""
.
Examples
# Show all options
dct_options()
#> $check_taxon_id
#> [1] TRUE
#>
#> $check_tax_status
#> [1] TRUE
#>
#> $check_mapping_accepted
#> [1] TRUE
#>
#> $check_mapping_parent
#> [1] TRUE
#>
#> $check_mapping_parent_accepted
#> [1] FALSE
#>
#> $check_mapping_original
#> [1] TRUE
#>
#> $check_mapping_accepted_status
#> [1] FALSE
#>
#> $check_sci_name
#> [1] TRUE
#>
#> $check_status_diff
#> [1] FALSE
#>
#> $check_col_names
#> [1] TRUE
#>
#> $valid_tax_status
#> [1] "accepted, synonym, variant, NA"
#>
#> $extra_cols
#> NULL
#>
#> $skip_missing_cols
#> [1] FALSE
#>
#> $on_success
#> [1] "data"
#>
#> $on_fail
#> [1] "error"
#>
#> $fill_taxon_id
#> [1] TRUE
#>
#> $fill_usage_id
#> [1] TRUE
#>
#> $taxon_id_length
#> [1] 32
#>
#> $clear_usage_id
#> [1] TRUE
#>
#> $clear_usage_name
#> [1] TRUE
#>
#> $fill_usage_name
#> [1] TRUE
#>
#> $remap_names
#> [1] TRUE
#>
#> $remap_parent
#> [1] TRUE
#>
#> $remap_variant
#> [1] FALSE
#>
#> $stamp_modified
#> [1] TRUE
#>
#> $stamp_modified_by
#> [1] FALSE
#>
#> $stamp_modified_by_id
#> [1] FALSE
#>
#> $strict
#> [1] FALSE
#>
#> $quiet
#> [1] FALSE
#>
#> $user_name
#> [1] ""
#>
#> $user_id
#> [1] ""
#>
# Store existing settings, including any changes made by the user
old_settings <- dct_options()
# View one option
dct_options()$valid_tax_status
#> [1] "accepted, synonym, variant, NA"
# Change one option
dct_options(valid_tax_status = "accepted, weird, whatever")
dct_options()$valid_tax_status
#> [1] "accepted, weird, whatever"
# Reset to default values
dct_options(reset = TRUE)
dct_options()$valid_tax_status
#> [1] "accepted, synonym, variant, NA"
# 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)