This function returns a named list providing the acceptable data types for the default tags. If no argument is provided, it returns default values. Otherwise, provided values will be used to define the defaults.
Arguments
- ...
a series of tags provided as
tag_name = "column_name"
, wheretag_name
indicates any of the known variables listed in 'Details'; alternatively, a namedlist
of variables to be tagged, where names indicate the types of variable (to be selected fromtags_names()
), and values indicate their name in the inputdata.frame
; see details for a list of known variable types and their expected content- allow_extra
a
logical
indicating if additional data tags not currently recognized bylinelist
should be allowed; ifFALSE
, unknown tags will trigger an error
See also
tags_defaults()
for the default tagsvalidate_types()
usestags_types()
for validating tagsvalidate_linelist()
usestags_types()
for validating tags
Author
Thibaut Jombart thibaut@data.org
Examples
# list default values
tags_types()
#> $id
#> [1] "numeric" "integer" "character"
#>
#> $date_onset
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_reporting
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_admission
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_discharge
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_outcome
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_death
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $gender
#> [1] "character" "factor"
#>
#> $age
#> [1] "numeric" "integer"
#>
#> $location
#> [1] "character" "factor"
#>
#> $occupation
#> [1] "character" "factor"
#>
#> $hcw
#> [1] "logical" "integer" "character" "factor"
#>
#> $outcome
#> [1] "character" "factor"
#>
# change existing values
tags_types(date_onset = "Date") # impose a Date class
#> $id
#> [1] "numeric" "integer" "character"
#>
#> $date_onset
#> [1] "Date"
#>
#> $date_reporting
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_admission
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_discharge
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_outcome
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_death
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $gender
#> [1] "character" "factor"
#>
#> $age
#> [1] "numeric" "integer"
#>
#> $location
#> [1] "character" "factor"
#>
#> $occupation
#> [1] "character" "factor"
#>
#> $hcw
#> [1] "logical" "integer" "character" "factor"
#>
#> $outcome
#> [1] "character" "factor"
#>
# add new types e.g. to allow genetic sequences using ape's format
tags_types(sequence = "DNAbin", allow_extra = TRUE)
#> $id
#> [1] "numeric" "integer" "character"
#>
#> $date_onset
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_reporting
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_admission
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_discharge
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_outcome
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $date_death
#> [1] "integer" "numeric" "Date" "POSIXct" "POSIXlt"
#>
#> $gender
#> [1] "character" "factor"
#>
#> $age
#> [1] "numeric" "integer"
#>
#> $location
#> [1] "character" "factor"
#>
#> $occupation
#> [1] "character" "factor"
#>
#> $hcw
#> [1] "logical" "integer" "character" "factor"
#>
#> $outcome
#> [1] "character" "factor"
#>
#> $sequence
#> [1] "DNAbin"
#>