aec_tto_plot: AEC time to onset plot

View source: R/aec_tto_plot.R

aec_tto_plotR Documentation

AEC time to onset plot

Description

Plots the stacked area chart for time-to-onset for the AEC Although the function takes only two arguments (a data frame containing the proportion of cases for inpatients, by time to onset and financial year), it relies on the presence of the following variables to that data frame, which must be precisely named:

fyear6

The financial year in format YYYY/YY

tto_group

Grouped time to onset variable, to allow side-by-side bars

pc

Proportion of cases

Usage

aec_tto_plot(x, collection = NULL)

Arguments

x

A data frame as specified above.

collection

One of "mrsa", "mssa", "cdi" or "ecoli"

Value

A ggplot object

Examples

## Not run: 
dat <- structure(list(fyear6 = c(201011L, 201011L, 201011L, 201516L, 201516L,
201516L),
tto_group = structure(c(3L, 2L, 1L, 3L, 2L, 1L),
.Label = c("< 2 days", "2-6 days", ">= 7 days"), class = "factor"),
pc = c(33L, 33L, 34L, 20L, 30L, 50L)), class = "data.frame",
row.names = c(NA, -6L), .Names = c("fyear6", "tto_group", "pc"))

p <- aec_tto_plot(dat)
p
p <- aec_tto_plot(dat, collection = "mrsa")
p
p <- aec_tto_plot(dat, collection = "cdi")
p

## End(Not run)

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