age_sex_pyramid: Age sex pyramid

View source: R/age_sex_pyramid.R

age_sex_pyramidR Documentation

Age sex pyramid

Description

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

Usage

age_sex_pyramid(dat, age_group, sex_var, y_var, y_var_label)

Arguments

x

A dataframe providing the data

Value

A ggplot object

Examples

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

PublicHealthEngland/hcaidcs documentation built on Jan. 19, 2024, 8:38 a.m.