# Run chart of 24 random vaiables
tcc(rnorm(24))
# Build data frame for examples
d <- data.frame(x = rep(1:24, 4),
mo = (rep(seq(as.Date('2013-1-1'),
length.out = 24,
by = 'month'),
4)),
n = rbinom(4 * 24, 100, 0.5),
d = round(runif(4 * 24, 90, 110)),
g1 = rep(c('a', 'b'), each = 48),
g2 = rep(c('A', 'B'), each = 24))
# Single, one-dimensional run chart
tcc(n, d, mo, data = subset(d, g1 == 'a' & g2 == 'A'))
# Run chart with one grouping variable and two groups
tcc(n, d, mo, g1 = g2, data = subset(d, g1 == 'a'))
# Run chart with two grouping variables
tcc(n, d, mo, g1 = g1, g2 = g2, data = d)
# I chart
tcc(n, d, mo, g1 = g1, g2 = g2, data = d, chart = 'i')
# P chart
tcc(n, d, mo, g1 = g1, g2 = g2, data = d, chart = 'p')
# P chart with baseline fixed to the first 12 data points
tcc(n, d, mo, g1 = g1, g2 = g2, data = d, chart = 'p', freeze = 12)
# P chart with two breaks
tcc(n, d, mo, g1 = g1, g2 = g2, data = d, chart = 'p', breaks = c(12, 18))
# P chart with two data points excluded from calculations
tcc(n, d, mo, g1 = g1, g2 = g2, data = d, chart = 'p', exclude = c(12, 18))Run the code above in your browser using DataLab