nest.incidence2: Nest rows into a list-column of data frames

View source: R/nest.R

nest.incidence2R 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 ... isn't specified, i.e. in the case of df %>% nest(.by = x).

If NULL, then "data" will be used by default.

.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()
}



incidence2 documentation built on Oct. 7, 2024, 1:07 a.m.