regroup_ {incidence2}R Documentation

Regroup 'incidence' objects (tidyselect compatible)

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. It differs from regroup() only in support for <tidy-select> semantics in the groups argument.

Usage

regroup_(x, groups = NULL)

Arguments

x

⁠<incidence2>⁠ object.

groups

<tidyselect>

The groups to sum over.

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

See Also

regroup() for a version without tidyselect semantics. This may be preferable for programatic usage.

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



[Package incidence2 version 2.3.1 Index]