View source: R/aggregate_model_internal.R
| aggregate_model_internal | R Documentation |
An Internal Function to Aggregate Model Output Using other Idmodelr functions.
aggregate_model_internal( df, aggregate_to = NULL, compartments = NULL, strat = NULL, hold_out_var = NULL, new_var = "incidence", id_col = NULL, groups = NULL, total_pop = TRUE, summary_var = FALSE )
df |
A dataframe of Model Output. |
aggregate_to |
A character vector specifying the aggregation function to apply possible values are; disease, demographic, or incidence. |
compartments |
A character vector specifying the unique compartments to aggregate. |
strat |
The number of stratified groups in the model. |
hold_out_var |
A character vector specifying the unique compartments not to aggregate. |
new_var |
A character vector specifying the new variable to add when aggregating incidence. |
id_col |
A character string containing the name of the new id column. |
groups |
A character vector with length equal to the level of stratification. Used to name the stratified levels. |
total_pop |
A logical (defaults to |
summary_var |
A logical (defaults to |
An aggregated dataframe.
aggregate_model aggregate_model_internal combine_to_age_model combine_strat_model_output summarise_var_by_strat
df <- data.frame(time = 1, A1 = 1, B1 = 1, A2 = 1, B2 = 1, A3 = 1, B3 = 1)
## Incidence
aggregate_model_internal(df, aggregate_to = "incidence",
compartments = c("A", "B"), strat = 3,
summary_var = TRUE)
## Demographic
aggregate_model_internal(df, aggregate_to = "demographic",
compartments = c("A", "B"), strat = 3,
summary_var = TRUE)
## Disease
aggregate_model_internal(df, aggregate_to = "disease",
compartments = c("A", "B"), strat = 3,
summary_var = TRUE)
## Tidy (long)
aggregate_model_internal(df, aggregate_to = "tidy",
compartments = c("A", "B"), hold_out_var = "time", strat = 3,
summary_var = TRUE, id_col = "Age",
groups = c("Children", "Young adults", "Adults"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.