Skip to contents

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)
}
#> # incidence:  1 x 3
#> # count vars: date_of_onset
#>   date_index count_variable count
#> * <date>     <chr>          <int>
#> 1 2013-04-03 date_of_onset      7