aec_age_trend_pc: Graph trend in percentage of cases by age group

View source: R/aec_age_trends_plots.R

aec_age_trend_pcR Documentation

Graph trend in percentage of cases by age group

Description

Prepares a graph for the trend in the proportion of cases that are from a particular age group. Intended to be used in conjunction with aec_age_trend_rate to plot a side-by-side figure. See age_trends_data for example of format for data to be used with this function.

Usage

aec_age_trend_pc(collection, data, x, y, sex, group, log_scale = FALSE)

Arguments

collection

One of CDI or Bacteraemia

data

A data frame

x

Variable giving financial year

y

Variable giving percentage of cases the age group makes for all cases for year

sex

Variable giving the sex group

group

Variable giving age group (using mandatory age groupings)

log_scale

Logical for whether a log y scale should be used. Defaults to FALSE

Value

A ggplot2 object

See Also

aec_age_trend_rate

Examples

data(age_trends_data)
p <- aec_age_trend_pc(collection = "CDI", data = age_trends_data,
    x = "fyear6", y = "age_sex_pc", sex = "sex", group = "age_group_new")
p

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