cusumPlot: cusumPlot

View source: R/cusumPlot.R

cusumPlotR Documentation

cusumPlot

Description

displays a straight-forward CUSUM plot

Usage

cusumPlot(
  .data,
  O = "Obs",
  E = "Exp",
  group = NA,
  ylab = "Cases Avoided",
  title = ""
)

Arguments

.data

dataframe containing the Observed, Expected and grouping variable, if any

O

name of column with observed rate/probability

E

name of column with expected rate /probability

group

column with grouping variable used to facet plots

ylab

y-axis label. default is "Cases Avoided"

title

plot title. default is blank

Examples

library(dplyr)
library(ggplot2)
oe_data <- data.frame(
     O = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
           0, 1, 1, 0, 0, 0, 0, 0, 0, 0),
     E = c(0.1, 0.1, 0.1, 0.1, 0.2, 0.2, 0.3, 0.3, 0.4, 0.4, 0.1, 0.1,
           0.1, 0.1, 0.2, 0.2, 0.3, 0.3, 0.4, 0.4),
     group = c(rep("Apple", 10), rep("Cherry", 10))
     )

cusumPlot(oe_data, "O", "E", "group", ylab = "avoided cases", title = "Title")

rparrish/RPamisc documentation built on Aug. 13, 2024, 3:49 a.m.