set_tags {linelist} | R Documentation |
Changes tags of a linelist object
Description
This function changes the tags
of a linelist
object, using the same
syntax as the constructor make_linelist()
. If some of the default tags are
missing, they will be added to the final object.
Usage
set_tags(x, ..., allow_extra = FALSE)
Arguments
x |
a |
... |
< |
allow_extra |
a |
Value
The function returns a linelist
object.
See Also
make_linelist()
to create a linelist
object
Examples
if (require(outbreaks)) {
## create a linelist
x <- make_linelist(measles_hagelloch_1861, date_onset = "date_of_rash")
tags(x)
## add new tags and fix an existing one
x <- set_tags(x,
age = "age",
gender = "gender",
date_onset = "date_of_prodrome"
)
tags(x)
## add non-default tags using allow_extra
x <- set_tags(x, severe = "complications", allow_extra = TRUE)
tags(x)
## remove tags by setting them to NULL
old_tags <- tags(x)
x <- set_tags(x, age = NULL, gender = NULL)
tags(x)
## setting tags providing a list (used to restore old tags here)
x <- set_tags(x, !!!old_tags)
tags(x)
}