Package 'runcharter'

Title: Automatically Plot, Analyse and Revises Limits of Multiple Run Charts
Description: Plots multiple run charts, finds successive signals of improvement, and revises medians when each signal occurs. Finds runs above, below, or on both sides of the median, and returns a plot and a data.table summarising original medians and any revisions, for all groups within the supplied data.
Authors: John MacKintosh [aut, cre]
Maintainer: John MacKintosh <[email protected]>
License: GPL (>= 3)
Version: 0.2.0.9000
Built: 2024-11-10 05:15:38 UTC
Source: https://github.com/johnmackintosh/runcharter

Help Index


runcharter

Description

Finds all runs of desired length occurring on desired side of median line. Can also find runs occurring on both sides of the line, though this is of limited use in terms of quality improvement. Re-bases median each time a run is discovered.

Usage

runcharter(
  df,
  med_rows = 13,
  runlength = 9,
  direction = c("above", "below", "both"),
  datecol = NULL,
  grpvar = NULL,
  yval = NULL,
  facet_cols = NULL,
  facet_scales = "fixed",
  chart_title = NULL,
  chart_subtitle = NULL,
  chart_caption = NULL,
  chart_breaks = NULL,
  line_colr = "#005EB8",
  line_size = 1.1,
  point_colr = "#005EB8",
  point_size = 2.5,
  median_colr = "#E87722",
  median_line_size = 1.05,
  highlight_fill = "#DB1884",
  highlight_point_size = 2.7
)

Arguments

df

data.frame or data table

med_rows

number of points to calculate initial baseline median

runlength

length of run that will trigger re-phased median

direction

should run occur "above", "below" or on "both" sides of median

datecol

name of date column

grpvar

character vector of grouping variable

yval

numeric y value

facet_cols

how many columns are required in the plot facets

facet_scales

defaults to "fixed". Alternatively, "free_y"

chart_title

title for the final chart

chart_subtitle

subtitle for chart

chart_caption

caption for chart

chart_breaks

character string defining desired x-axis date / datetime breaks. If the x axis is not a Date or datetime, then this argument is ignored, and ggplot2 will provide default breaks

line_colr

colour for run chart lines

line_size

thickness of connecting lines between run chart points

point_colr

colour for run chart points

point_size

size of normal run chart points

median_colr

colour for solid and extended median lines

median_line_size

thickness of solid and extended median lines

highlight_fill

fill colour for highlighting points in a sustained run

highlight_point_size

size of highlighted points in a sustained run

Details

Facets and axis limits are handled by ggplot, though x-axis breaks can be specified using the appropriate character string e.g. "3 months" if they are either of class dates or datetime

Value

list - faceted plot and data.table showing all identified runs

Examples

runcharter(signals, med_rows = 13, runlength = 9,
direction = "above", datecol = date, grpvar = grp, yval = y,
facet_cols = 2,chart_title = "Automated runs analysis",
chart_subtitle = " some runs found", chart_caption = "powered by R",
chart_breaks = "6 months")

#' 220 grouped observations over time.

Description

A dataset containing four equal groups of 55 integers simulating signals of improvement in multiple directions relative to their respective baseline medians.

Usage

signals

Format

A data frame with 220 rows and 4 variables:

grp

a grouping variable, representing a specific department

y

integers representing counts of an event over time

date

date of the observation, by month