View source: R/add_population_age_to.R
add_population_age_to | R Documentation |
Adds the population distribution of contact ages. Requires a column called
"age_to", representing the contact age - the age of the person who had
contact. It creates a column, pop_age_to
. The population
argument
defaults to get_polymod_population()
, which is a conmat_population
object, which has age
and population
specified. But this can also be
a data frame with columns, lower.age.limit
, and population
. If
population is 'polymod' then use the participant-weighted average of
POLYMOD country/year distributions. It adds the population via
interpolation, using get_age_population_function()
to create a
function that generates population from ages.
add_population_age_to(contact_data, population = get_polymod_population())
contact_data |
contact data containing columns |
population |
Defaults to |
data frame of contact_data
with the number of intergenerational
mixing contacts added.
age_min <- 10
age_max <- 15
all_ages <- age_min:age_max
library(tidyr)
example_df <- expand_grid(
age_from = all_ages,
age_to = all_ages,
)
add_population_age_to(example_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.