View source: R/aec_age_trends_plots.R
| aec_age_trend_pc | R Documentation | 
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.
aec_age_trend_pc(collection, data, x, y, sex, group, log_scale = FALSE)
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  | 
A ggplot2 object
aec_age_trend_rate
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.