Description Usage Arguments Value Examples
View source: R/qccOperations.R
This function provides a simplified interface to the qcc function. The main goal is to remove the need for using the qcc groups function. This allows for much simpler use of the function within piping functions/map.
1 |
formula |
a formula describing the outcome variable and the grouping variable | ||||||||||||||||||||||||||||||
data |
a data frame | ||||||||||||||||||||||||||||||
type |
a character string specifying the group statistics to compute.
Furthermore, a user specified type of chart, say | ||||||||||||||||||||||||||||||
plot |
logical. If | ||||||||||||||||||||||||||||||
cutoff |
a cutoff date for new data | ||||||||||||||||||||||||||||||
... |
further arguments passed to |
a qcc object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | data("pistonrings", package = 'qcc')
diameter <- qcc::qcc.groups(pistonrings$diameter, pistonrings$sample)
# Without Cutoff
qcc_obj <- qcc::qcc(diameter[1:25,], type="xbar")
qcc_obj2 <- qcc.formula(diameter ~ sample, data = dplyr::filter(pistonrings, sample <= 25), type = "xbar", plot = TRUE)
# With Cutoff
qcc_new <- qcc::qcc(diameter[1:25,], newdata = diameter[24:40,], type="xbar")
qcc_new2 <- qcc.formula(diameter ~ sample, data = pistonrings, type = "xbar", plot = TRUE, cutoff = 25)
# Dates and p chart
## use POSIXct, not Date object to create date
start <- as.POSIXct('2017-01-01')
end <- as.POSIXct('2017-01-15')
samp_dates <- seq(from = start, to = end, length.out = 15)
samp_dates <- sample(samp_dates, 100, replace = TRUE)
old_process <- samp_dates < '2017-01-08'
vals <- ifelse(old_process,rbinom(sum(old_process), 1 , p = 0.5), rbinom(sum(!old_process), 1, p = 0.2) )
d <- data.frame(samp_dates, vals)
## Run the graphs with plot = TRUE
qcc.formula(vals ~ samp_dates, data = d, type = "p", plot = TRUE)
qcc.formula(vals ~ samp_dates, data = d, type = "p", plot = TRUE, cutoff = '2017-01-08')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.