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.

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 number of points to calculate initial baseline median length of run that will trigger re-phased median should run occur "above", "below" or on "both" sides of median name of date column character vector of grouping variable numeric y value how many columns are required in the plot facets defaults to "fixed". Alternatively, "free_y" title for the final chart subtitle for chart caption for chart character string defining desired x-axis date breaks colour for run chart lines thickness of connecting lines between run chart points colour for run chart points size of normal run chart points colour for solid and extended median lines thickness of solid and extended median lines fill colour for highlighting points in a sustained run size of highlighted points in a sustained run further arguments passed on to function

## Value

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

## 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"

## Examples

# \donttest{
runcharter(signals, med_rows = 13, runlength = 9,
direction = "above", datecol = "date", grpvar ="grp", yval ="y",
facet_cols = 2,chart_title = "Automated runs analysis",
#> $runchart#> #>$sustained