View source: R/predictions_to_matrix.R
predictions_to_matrix | R Documentation |
Helper function to convert predictions of contact rates in data frames to matrix format with the survey participant age groups as columns and contact age groups as rows.
predictions_to_matrix(contact_predictions, ...)
contact_predictions |
data frame with columns |
... |
extra arguments |
Square matrix with the unique age groups from age_group_from/to
in the rows and columns and contacts
as the values.
fairfield <- abs_age_lga("Fairfield (C)")
# We can convert the predictions into a matrix
fairfield_school_contacts <- predict_contacts(
model = polymod_setting_models$school,
population = fairfield,
age_breaks = c(0, 5, 10, 15, Inf)
)
fairfield_school_contacts
# convert them back to a matrix
predictions_to_matrix(fairfield_school_contacts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.