regroup: Regroup 'incidence' objects

View source: R/regroup.R

regroupR Documentation

Regroup 'incidence' objects

Description

This function regroups an ⁠<incidence2>⁠ object across the specified groups. The resulting ⁠<incidence2>⁠ object will contains counts summed over the groups present in the input.

Usage

regroup(x, groups = NULL)

Arguments

x

⁠<incidence2>⁠ object.

groups

⁠[character]⁠

The groups to sum over.

If NULL (default) then the function returns the corresponding object with no groupings.

Examples

if (requireNamespace("outbreaks", quietly = TRUE)) {

    data(ebola_sim_clean, package = "outbreaks")
    dat <- ebola_sim_clean$linelist
    i <- incidence(
        dat,
        date_index = "date_of_onset",
        groups = c("gender", "hospital")
    )
    regroup(i)
    regroup(i, "hospital")

}


incidence2 documentation built on July 9, 2023, 5:35 p.m.