View source: R/age_sex_pyramid.R
age_sex_pyramid | R Documentation |
Create an age-sex pyramid for commentaries. Credit where it's due, much of this has been cribbed from Seb Fox's fingertipscharts package. https://github.com/publichealthengland/fingertipscharts/blob/master/R/quick_charts.R
age_sex_pyramid(dat, age_group, sex_var, y_var, y_var_label)
x |
A dataframe providing the data |
A ggplot object
data(age_trends_data)
head(age_trends_data)
## To get the right sorting and labels for the age groups
age_trends_data$age_group2 <- graph_age_groups(age_trends_data$age_group_new,
data_collection = "cdi")
p <- age_sex_pyramid(dat = subset(age_trends_data, fyear6 == 200708),
age_group = age_group2, sex_var = sex, y_var = rate,
y_var_label = "Rate, per 100,000 population")
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.