QC_Violations: Calculate QC Violations

Description Usage Arguments Value Note References Examples

View source: R/02_QC_Violations.R

Description

function that calculates QC violations on sequentially ordered data based on the following 4 rules:

Usage

1
2
QC_Violations(data, value = NULL, grouping = NULL, formula = NULL,
  method = NULL, ...)

Arguments

data

vector or dataframe, as indicated below for each chart type

  • Individuals: vector of values;

  • Studentized Charts: dataframe

value

Studentized Charts: numeric vector in dataframe with values of interest

grouping

Studentized Charts: single factor/variable to split the dataframe "values" by

formula

Studentized Charts: a formula, such as y ~ x1 + x2, where the y variable is numeric data to be split into groups according to the grouping x factors/variables

method

string, calling the following methods:

  • Individuals Charts: XmR,

  • Studentized Charts: xBar.rBar, xBar.rMedian, xBar.sBar, xMedian.rBar, xMedian.rMedian

...

further arguments passed to or from other methods.

Value

a dataframe, with the following columns

Note

If using the formula argument do not use value and group arguments.

References

Wheeler, DJ, and DS Chambers. Understanding Statistical Process Control, 2nd Ed. Knoxville, TN: SPC, 1992. Print.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#####################################
#  Example 1: XmR Check Violations  #
#####################################
# Load Libraries ----------------------------------------------------------
 require(ggQC)

# Setup Data --------------------------------------------------------------

    set.seed(5555)
    QC_XmR <- data.frame(
    data = c(c(-1, 2.3, 2.4, 2.5),                        #Outlier Data
          sample(c(rnorm(60),5,-5), 62, replace = FALSE), #Normal Data
          c(1,-.3, -2.4,-2.6,-2.5,-2.7, .3)),             #Outlier Data
    Run_Order = 1:73                                      #Run Order
    )

   QC_Vs <- QC_Violations(data  = QC_XmR$data, method = "XmR")

#######################################
#  Example 2: Xbar Check Violations   #
#######################################

# Setup Some Data ------------------------------------------------------------
     QC_xBar.rBar <- do.call(rbind, lapply(1:3, function(X){
       set.seed(5555+X)                                   #Loop over 3 seeds
       data.frame(
         sub_group = rep(1:42),                           #Define Subgroups
         sub_class = letters[X],
         c(
          c(runif(n = 5, min = 2.0,3.2)),                 #Outlier Data
          sample(c(rnorm(30),5,-4), 32, replace = FALSE), #Normal Data
          c(runif(n = 5, min = -3.2, max = -2.0))         #Outlier Data
         )
      )
     }
   )
)

colnames(QC_xBar.rBar) <- c("sub_group","sub_class", "value")
QC_Vs <- QC_Violations(data  = QC_xBar.rBar,
                       formula = value~sub_group,
                       method = "xBar.rBar")

kenithgrey/rQC documentation built on May 20, 2019, 9:04 a.m.