A pair of helper functions allowing filtering out of recent touchstone values and excluded diseases.
Usage
filter_recent_ts(df, threshold = DEF_TOUCHSTONE_NEW)
filter_excluded_diseases_ts(df, threshold = DEF_TOUCHSTONE_OLD_OLD)
flag_duplicates(df, key_cols = COLNAMES_KEY_PRESSURE_TEST)
filter_invalid_trajectories(
df,
prev_data,
outcome = c("deaths_averted", "dalys_averted")
)Arguments
- df
A
<data.frame>holding impact data. This data.frame is not checked for contents- threshold
A six-digit number that is checked as a valid touchstone identifier (YYYYMM format) using
validate_ts_year(). Defaults to DEF_TOUCHSTONE_NEW ("202310").- key_cols
Key columns in
dfto check for duplicates.- prev_data
A
<data.frame>holding data from a previous touchstone for the same scenarios asdf.- outcome
A string giving the outcome of interest; may be one of
"deaths_averted"or"dalys_averted".
Value
A filtered <data.frame>.
filter_recent_ts()returnsdfwith rows where the touchstone condition is not met excluded.filter_excluded_diseases_ts()returnsdfwith rows where rows relating to the EXCLUDED_DISEASES, when the touchstone year indfis less than thethreshold, excluded.flag_duplicates()returnsdfwith duplicated combinations ofkey_colsflagged using the columnn_key(or a user-defined name).filter_invalid_trajectories()returnsdfwith bad outcome trajectories (NAto non-NA) removed.