This function calculates the number of averted cases for different interventions compared to a base scenario.

get_averted_df(base, interventions)

Arguments

base

A data frame containing the base scenario data with columns s, outcome, age_group, and cases_total.

interventions

A data frame containing the intervention scenario data with columns s, outcome, age_group, and cases_total.

Value

A data frame with the calculated averted cases and proportions, with recoded age groups and outcomes.

Details

The function performs the following steps:

  • Joins the base and intervention data frames on s, outcome, and age_group.

  • Calculates the total number of cases averted and the proportion of cases averted.

  • Recodes the age groups and outcomes to more descriptive labels.

  • Converts the recoded age groups and outcomes to factors with specific levels.

Examples

if (FALSE) { # \dontrun{
base <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(100, 200, 150, 120, 130))
interventions <- data.frame(s = 1:5, outcome = rep("symptomatic", 5), age_group = 1:5, cases_total = c(90, 180, 140, 110, 120))
get_averted_df(base, interventions)
} # }