find_peak: Find the peak date of an incidence curve

View source: R/find_peak.R

find_peakR Documentation

Find the peak date of an incidence curve

Description

This function can be used to find the peak of an epidemic curve stored as an ⁠[incidence2]⁠ object.

Usage

find_peak(x, complete_dates = TRUE, ...)

Arguments

x

⁠<incidence2>⁠ object.

complete_dates

⁠[bool]⁠

Should complete_dates() be called on the data prior to keeping the first entries.

Defaults to TRUE.

...

Other arguments passed to complete_dates().

Value

An ⁠[incidence2]⁠ object the date of the (first) highest incidence in the data along with the count. If x is grouped object then the output will have the peak calculated for each grouping.

See Also

estimate_peak() for bootstrap estimates of the peak time.

Examples

if (requireNamespace("outbreaks", quietly = TRUE)) {
  # load data and create incidence
  data(fluH7N9_china_2013, package = "outbreaks")
  i <- incidence(fluH7N9_china_2013, date_index = "date_of_onset")
  find_peak(i)
}


i2extras documentation built on March 31, 2023, 5:23 p.m.