summarise.incidence2: Summarise each grouping down to one row

View source: R/summarise.R

summarise.incidence2R Documentation

Summarise each grouping down to one row

Description

Method for dplyr::summarise that implicitly accounts for the inherent grouping structure of incidence2 objects.

Usage

## S3 method for class 'incidence2'
summarise(.data, ..., .by, .groups)

Arguments

.data

An incidence2 object.

...

<data-masking> Name-value pairs. The name gives the name of the column in the output.

The value can be:

  • A vector of length 1, which will be recycled to the correct length.

  • A vector the same length as the current group (or the whole data frame if ungrouped).

  • NULL, to remove the column.

  • A data frame or tibble, to create multiple columns in the output.

.by

Not used as grouping structure implicit.

.groups

Not used.

Value

A tibble.

See Also

dplyr::summarise for the underlying grouping.

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") |>
        summarise(model = list(glm(count ~ date_index, family = "poisson")))
}



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