Learn R Programming

qicharts (version 0.4.1)

trc: Trellis run charts for multivariate data

Description

Run charts for multivariate data in trellis (grid) layout.

Usage

trc(x, chart = c("run", "i"), xscale = "same", yscale = "same",
  dec = NULL, xpad = 0.1, pch = 20, cex = 0.7, gap = 0.5,
  target = NA, direction = NULL, ...)

Arguments

x
Formula object to plot. The formula is of the form y ~ x | g1 + g2 + ..., indicating that plots of y (on the y-axis) versus x (on the x-axis) should be produced conditional on the variables g1, g2.
chart
Type of chart: 'run' or 'i'.
xscale
Scaling of x-axes: 'same' or 'free'.
yscale
Scaling of y-axes: 'same' or 'free'.
dec
Number of decimals of median value. The default behaviour (smart rounding to at least two significant digits) should be satisfactory in most cases.
xpad
Number specifying the fraction by which to extend the x-axis in order to make space for the median label.
pch
Plotting character.
cex
Number indicating the magnification of plotting character.
gap
Number indicating spacing between panels.
target
Value specifying a target line to plot.
direction
Value indication direction of improvement, 0 (down) or 1 (up).
...
Further arguments to xyplot.

Value

  • Returns an object of class "trellis".

Details

This function is a wrapper for xyplot from the lattice package. Some usefull arguments from xyplot are main, ylab, xlab, and layout.

See Also

xyplot, qic

Examples

Run this code
# Trellis run chart on 1 conditioning variable
d1 <- data.frame(y = rnorm(96, 12, 3),
                 expand.grid(x = 1:24,
                             g = LETTERS[1:4]))
trc(y ~ x | g, data = d1, main = 'Trellis run chart')

# Add target line
trc(y ~ x | g, data = d1, main = 'Trellis run chart', target = 20)

# Trellis run chart on 2 conditioning variables
d2 <- data.frame(y = rnorm(144, 12, 3),
                 expand.grid(x = seq.Date(as.Date('2014-1-1'),
                                          by = 'week',
                                          length.out = 24),
                             g1 = LETTERS[1:3],
                             g2 = letters[1:2]))
trc(y ~ x | g1 + g2, data = d2, main = 'Trellis run chart')

# Introduce a shift in process performance
d2$y[132:144] <- d2$y[132:144] * 3
trc(y ~ x | g1 + g2, data = d2, main = 'Trellis run chart')

# Make I chart
trc(y ~ x | g1 + g2, data = d2, main = 'Trellis run chart', chart = 'i')

Run the code above in your browser using DataLab