Learn R Programming

incidence2 (version 0.2.2)

regroup: Regroup 'incidence' objects

Description

This function regroups an incidence() object across the specified groups. The resulting incidence() object will contains counts summed over the groups present in the input.

Usage

regroup(x, groups = NULL)

Arguments

x

An incidence() object.

groups

The groups to sum over. If NULL (default) then the function ignores all groups.

Examples

Run this code
# NOT RUN {
if (requireNamespace("outbreaks", quietly = TRUE)) {
  withAutoprint({
    data(ebola_sim_clean, package = "outbreaks")
    dat <- ebola_sim_clean$linelist
    i <- incidence(dat,
                   date_index = date_of_onset,
                   groups = c(gender, hospital))

    i %>% regroup()

    i %>% regroup(hospital)
  })
}

# }

Run the code above in your browser using DataLab