controlChart: creates a ggplot object showing a control chart with optional...

View source: R/generalStat.R

controlChartR Documentation

creates a ggplot object showing a control chart with optional control lines

Description

creates a ggplot object showing a control chart with optional control lines

Usage

controlChart(
  data,
  yColumn,
  xColumn = NA,
  removeNA = TRUE,
  drawPoints = TRUE,
  pointColor = "black",
  pointFill = "orange",
  pointShape = 21,
  pointSize = 3,
  pointAlpha = 0.75,
  drawLine = TRUE,
  lineColor = "black",
  lineType = "solid",
  lineWidth = 1,
  lineAlpha = 1,
  controlLines = controlChartMarkerLines(yValues = NA),
  xLabel = "#",
  yLabel = NA,
  title = paste("Control Chart ", ifelse(identical(yLabel, NA), "", paste("of ", yLabel,
    sep = "")), sep = ""),
  xAxis = TRUE,
  yAxis = TRUE,
  vertical = FALSE,
  xDefault = FALSE,
  xLimits = c(NA, NA),
  yDefault = TRUE,
  yLimits = c(NA, NA),
  ...
)

Arguments

data

the data to be plotted, can be a numeric/character/etc vector or data.frame like (or tibble etc). If it is data.frame or similar the column argument defines which column is to be used

yColumn

defines which column is to be used for y-axis ib the plot. Can be integer or character (column name)

xColumn

defines which column is to be used for the x-axis, can be integer or character (column name). If the column consists of date/time values, then set the parameter xDefault to TRUE. Note: this parameter is optional, default is NA

removeNA

if TRUE, the NA 'values' in the vector will be removed prior to plotting. @note this will remove warning messages and errors

drawPoints

boolean, if TRUE then the data points themselves will be drawn

pointColor

defines the color of the border of the data points

pointFill

defines the color of the data points themselves

pointShape

shape of the data points

pointSize

size of the data points

pointAlpha

alpha ('see through' value) of the data points

drawLine

boolean, if TRUE then a line through the data points will be drawn

lineColor

color of the line

lineType

type of the line

lineWidth

width of the line

lineAlpha

alpha ('see through' value) of the line

controlLines

either NA (no horizontal lines) or a data.frame with columns yValues, type, color, width, alpha. yValues defines at which 'height' (y-axis) the control lines are to be drawn. Use the function controlChartMarkerLines for this if needed

xLabel

defines x-axis label

yLabel

defines y-axis label (if not defined (NA), then the yColumn name will be used, if possible)

title

sets title of graph

xAxis

defines if the x-axis is shown

yAxis

defines if the x-axis is shown

vertical

if TRUE, flips x- and y-axis

xDefault

default is set to TRUE, together with xLimits, this can be used to define the exact range of the X-axis

xLimits

default = c(0,NA), together with xDefault, this can be used to define the exact range of the Y-axis

yDefault

default is set to TRUE, together with yLimits, this can be used to define the exact range of the Y-axis

yLimits

default = c(0,NA), together with yDefault, this can be used to define the exact range of the Y-axis

...

can be used to pass on other arguments to graphAdjust() (like xLimits, xExpand, etc)

Value

a ggplot object


BenBruyneel/BBPersonalR documentation built on Aug. 23, 2024, 8:28 p.m.