nest.incidence2 {incidence2} | R Documentation |
Nest rows into a list-column of data frames
Description
Method for tidyr::nest that implicitly accounts for the inherent grouping structure of incidence2 objects.
Usage
## S3 method for class 'incidence2'
nest(.data, ..., .by, .key, .names_sep)
Arguments
.data |
An incidence2 object. |
... |
Not used. |
.by |
Not used. |
.key |
The name of the resulting nested column. Only applicable when
If |
.names_sep |
Not used. |
Value
A nested tibble with rows corresponding to the count variable and (optionally) group columns of the input object.
See Also
tidyr::nest for the underlying generic.
Examples
if (requireNamespace("outbreaks", quietly = TRUE)) {
data(ebola_sim_clean, package = "outbreaks")
ebola_sim_clean$linelist |>
subset(!is.na(hospital)) |>
incidence_(date_of_onset, hospital, interval = "isoweek") |>
nest()
}
[Package incidence2 version 2.3.1 Index]