Learn R Programming

incidence2 (version 2.6.2)

split.incidence2: Divide an incidence2 object in to it's implicit groupings

Description

Split divides and incidence2 object in to it's underlying groupings (count variable and optionally groups).

Usage

# S3 method for incidence2
split(x, f, drop, ...)

Value

A list of tibbles contained the split data. This list also has a "key" attribute which is a tibble with rows corresponding to the grouping of each split.

Arguments

x

An incidence2 object.

f

Not used. Present only for generic compatibility.

drop

Not used. Present only for generic compatibility.

...

Not used. Present only for generic compatibility.

See Also

vctrs::vec_split() on which split.incidence2() is built.

Examples

Run this code
.old <- data.table::setDTthreads(2)
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") |>
        split()
}
data.table::setDTthreads(.old)

Run the code above in your browser using DataLab