aec_age_trend_rate: Graph trend in rate of cases by age and sex

aec_age_trend_rateR Documentation

Graph trend in rate of cases by age and sex

Description

Prepares a graph for the trend in the rate of cases that are from a particular age group. Intended to be used in conjunction with aec_age_trend_pc 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_rate(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 rate for age group by sex and 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_pc

aec_age_trend_rate_pc_change

Examples

data(age_trends_data)
q <- aec_age_trend_rate(collection = "CDI", data = age_trends_data,
    x = "fyear6", y = "rate", sex = "sex", group = "age_group_new",
    log_scale = TRUE)
q

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