Learn R Programming

epiCo (version 1.0.1)

age_risk: Returns the specific rates associated with being infected given age and sex

Description

Function that returns the specific rates of being infected given age and sex

Usage

age_risk(age, population_pyramid, sex = NULL, plot = FALSE)

Value

A dataframe with the proportion or total count of individuals

Arguments

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

Examples

Run this code
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
)

Run the code above in your browser using DataLab