age_risk | R Documentation |
Function that returns the specific rates of being infected given age and sex
age_risk(age, population_pyramid, sex = NULL, plot = FALSE)
age |
A vector with the ages of cases in years from 0 to 100 years |
population_pyramid |
A dataframe with the count of individuals with the columns age, population and sex |
sex |
A vector with the sex of cases 'F' and 'M'. The default value is NULL |
plot |
A boolean for displaying a plot. The default value is FALSE |
A dataframe with the proportion or total count of individuals
pop_pyramid <- population_pyramid("15001", 2015,
sex = TRUE, total = TRUE,
plot = FALSE
)
ages <- round(runif(150, 0, 100))
sex <- c(rep("M", 70), rep("F", 80))
age_risk(
age = ages, sex = sex, population_pyramid = pop_pyramid,
plot = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.