| desc_year | R Documentation |
Compute yearly epi descriptors based on weekly case counts.
desc_year(
data,
cases,
time,
space,
descriptors,
pop = NULL,
sweek = 1,
collapse53 = TRUE
)
data |
Data frame with the input data. |
cases |
Character. Name of the variable in |
time |
Character. Name of the variable in |
space |
Character. Name of the variable in |
descriptors |
A named list with the descriptor function and their arguments. See details. |
pop |
Character. Name of the variable in |
sweek |
Integer between 1-52 that determines the first week of
the season for which the descriptors will be calculated; e.g. |
collapse53 |
If TRUE (default), collapse week 53 such that half of the cases are assigned to the previous (w52) and next (w01) weeks. It is recommended so that all years have the same number of weeks. |
The argument descriptors consists of a nested list where:
The name of the first level will determine the name of the descriptor.
The elements of the first levels should also be a list with elements
fun (descriptor type) and the parameters n, x or p if necessary.
Please see the example to see it in practice.
A data frame with the resulting descriptors for every epidemiological year.
desc_list to access the list of descriptors and its parameters.
# Spatiotemporal
data(dengueRio)
dengue <- dengueRio
# Prepare epiyearweeks
dengue$yearweek <- epiyearweek(dengue$date)
# List of descriptors to be computed
descriptors <- list(
"Ap" = list(fun = "Ap"),
"Tp" = list(fun = "Tp"),
"Cnf" = list(fun = "Cnf", n = 3, x = 5),
"Cnf2" = list(fun = "Cnf", n = 6, x = 5),
"Cmax" = list(fun = "Cmax", x = 5),
"Cmed" = list(fun = "Cmed", x = 5),
"p" = list(fun = "p", x = 5),
"Cwf" = list(fun = "Cwf", n = 3),
"Cwf2" = list(fun = "Cwf", n = 6),
"Cwmax" = list(fun = "Cwmax"),
"Cwmed" = list(fun = "Cwmed"),
"Inc" = list(fun = "Inc", p = 1e5)
)
# Compute them
res <- desc_year(
dengue,
cases = "cases",
time = "yearweek",
space = "muni_code",
pop = "pop",
sweek = 40,
descriptors = descriptors
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.