View source: R/data-converters.R
enw_add_incidence | R Documentation |
Calculate incidence of new reports from cumulative reports
enw_add_incidence(obs, set_negatives_to_zero = TRUE, by = NULL, copy = TRUE)
obs |
A |
set_negatives_to_zero |
Logical, defaults to TRUE. Should negative
counts (for calculated incidence of observations) be set to zero? Currently
downstream modelling does not support negative counts and so setting must be
TRUE if intending to use |
by |
A character vector describing the stratification of observations. This defaults to no grouping. This should be used when modelling multiple time series in order to identify them for downstream modelling |
copy |
Should |
The input data.frame
with a new variable new_confirm
. If
max_confirm
is present in the data.frame
, then the proportion
reported on each day (prop_reported
) will also be added.
Data converters
enw_add_cumulative()
,
enw_aggregate_cumulative()
,
enw_cumulative_to_incidence()
,
enw_incidence_to_cumulative()
,
enw_incidence_to_linelist()
,
enw_linelist_to_incidence()
# Default reconstruct incidence
dt <- germany_covid19_hosp[location == "DE"][age_group == "00+"]
enw_add_incidence(dt)
# Make use of maximum reported to calculate empirical daily reporting
dt <- enw_add_max_reported(dt)
enw_add_incidence(dt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.