trc {qicharts} | R Documentation |
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,
...
)
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. |
... |
Further arguments to xyplot. |
Details
This function is a wrapper for xyplot
from the
lattice
package. Some usefull arguments from
xyplot
are main
, ylab
, xlab
, and
layout
.
Value
Returns an object of class "trellis".
See Also
Examples
# 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')