enw_aggregate_cumulative | R Documentation |
This function aggregates observations over a specified timestep,
ensuring alignment on the same day of week for report and reference dates.
It is useful for aggregating data to a weekly timestep, for example which
may be desirable if testing using a weekly timestep or if you are very
concerned about runtime. Note that the start of the timestep will be
determined by min_date
+ a single timestep (i.e. the
first timestep will be "2022-10-23" if the minimum reference date is
"2022-10-16").
enw_aggregate_cumulative(
obs,
timestep = "day",
by = NULL,
min_reference_date = min(obs$reference_date, na.rm = TRUE),
copy = TRUE
)
obs |
An object coercible to a |
timestep |
The timestep to used. This can be a string ("day", "week", "month") or a numeric whole number representing the number of days. |
by |
A character vector of variables to also aggregate by (i.e. as well
as using the |
min_reference_date |
The minimum reference date to start the
aggregation from. Note that the timestep will start from the minimum
reference date + a single time step (i.e. the first timestep will be
"2022-10-23" if the minimum reference date is "2022-10-16"). The default
is the minimum reference date in the |
copy |
Should |
A data.table with aggregated observations.
Data converters
enw_add_cumulative()
,
enw_add_incidence()
,
enw_cumulative_to_incidence()
,
enw_incidence_to_cumulative()
,
enw_incidence_to_linelist()
,
enw_linelist_to_incidence()
nat_hosp <- germany_covid19_hosp[location == "DE"][age_group == "00+"]
enw_aggregate_cumulative(nat_hosp, timestep = "week")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.