
Add the maximum number of reported cases for each reference_date
Source: R/preprocess.R
enw_add_max_reported.RdThis is a helper function which adds the maximum (in the sense of latest observed) number of reported cases for each reference_date and computes the proportion of already reported cases for each combination of reference_date and report_date.
Value
A data.table with new columns max_confirm and cum_prop_reported.
max_confirm is the maximum number of cases reported for a certain
reference_date. cum_prop_reported is the proportion of cases for a certain
reference_date that are reported until a given report_day, relative to all
cases so far observed for this reference_date.
See also
Preprocessing functions
enw_add_delay(),
enw_add_metaobs_features(),
enw_assign_group(),
enw_complete_dates(),
enw_construct_data(),
enw_extend_date(),
enw_filter_delay(),
enw_filter_reference_dates(),
enw_filter_report_dates(),
enw_flag_observed_observations(),
enw_impute_na_observations(),
enw_latest_data(),
enw_metadata(),
enw_metadata_delay(),
enw_missing_reference(),
enw_preprocess_data(),
enw_reporting_triangle(),
enw_reporting_triangle_to_long()
Examples
obs <- data.frame(report_date = as.Date("2021-01-01") + 0:2)
obs$reference_date <- as.Date("2021-01-01")
obs$confirm <- 1:3
enw_add_max_reported(obs)
#> reference_date report_date .group max_confirm confirm cum_prop_reported
#> <IDat> <IDat> <num> <int> <int> <num>
#> 1: 2021-01-01 2021-01-01 1 3 1 0.3333333
#> 2: 2021-01-01 2021-01-02 1 3 2 0.6666667
#> 3: 2021-01-01 2021-01-03 1 3 3 1.0000000