runcharter: runcharter

Description Usage Arguments Details Value Examples

View source: R/runcharter.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

1
2
3
4
5
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")

runcharter documentation built on Nov. 9, 2021, 9:06 a.m.