aec_ec_source_plot: Plot the most likely primary focus for E. coli bacteraemia by...

View source: R/aec_ec_primary_focus_plot.R

aec_ec_source_plotR Documentation

Plot the most likely primary focus for E. coli bacteraemia by time to onset

Description

Although the function takes a single argument (a data frame), it relies on the presence of several variables to that data frame: * tto_group The grouped time to onset, generated by group_tto_bacteraemia * primary_focus One of the primary foci in group_source_bacteraemia * pc The percentage that the focus occurs within tto_group

Usage

aec_ec_source_plot(x)

Arguments

x

A data frame

Value

A ggplot2 object

See Also

group_tto_bacteraemia group_source_bacteraemia

Examples

## Not run: 
dat <- structure(list(
tto_group = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L),
.Label = c("<2", "2-6", "ge7"), class = "factor"),
primary_focus = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 1L,
2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L),
.Label = c("gastro", "hepatobil", "other", "respiratory", "unknown", "uti"),
class = "factor"),
pc = c(20, 20, 20, 20, 10, 10,
30, 20, 10, 10, 10, 20, 50, 10, 10, 10, 10,
10)), .Names = c("tto_group", "primary_focus", "pc"),
class = "data.frame", row.names = c(NA, -18L))

pal <- phecharts::brewer_phe("phe", length(levels(dat$primary_focus)))

p <- aec_ec_source_plot(dat)
p

## End(Not run)

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