Other sites

ggQC | ggplot Quality Control Charts – New Release

The ggQC package is a quality control extension for ggplot. Use it to create XmR, XbarR, C and many other highly customizable Control Charts. Additional statistical process control functions include Shewart violation checks as well as capability analysis. If your process is running smoothly, visualize the potential impacted of your next process improvement with a Pareto chart. To learn more, read on!

To get started with ggQC, install it from CRAN by running the following code:

1

install.packages("ggQC")

ggQC Control Charts

Control charts are a great way to monitor process outputs, drive improvement, and evaluate measurement systems. The types of control chart types supported by ggQC include:

The process for building control charts with ggQC is simple. First, load the ggQC and ggplot2 libraries. Next, load your data into R. Your data should be in long-form. The data set below provides an example of long form data if you're not familiar with the term.

Finally, make your control chart using standard ggplot layer-by-layer syntax and the stat_QC() command. The example code below, shows how all these steps come together to make an XmR plot.

By building upon the ggplot framework, you get a high level of control over the plot details such as points and lines etc. In addition, if you want to put XmR and mR data on the same plot, you can. Just make multiple calls to the stat_QC() command, as shown below.

After executing the code, you should see a plot with 4 facets – one for each Shewart rule. If you only want to see the 4th facet, set show.facets = 4. Other settings such as show.facets = c(2, 4) will show 1 and 3 sigma violations, only.

Capability Analysis

In the previous sections, you learned how to make a control chart with ggQC and check for violations. Here you'll learn how to do a basic capability analysis (Cp, Cpk, Pp, Ppk etc.). For this, we assume the customer has a lower specification limit (LSL) and upper specification limit (USL) of 25 and 37, respectively. With these specifications and the stat_QC_Capability() command, you can do a graphical capability analysis in just a few simple lines of code:

To adjust the capability metrics displayed on the plot, provide the show.cap.summary argument with a vector of desired metrics. Metrics available include:

TOL: Tolerance in Sigma Units (USL-LSL)/sigma

DNS: Distance to Nearest Specification Limit in Sigma Units

Cp: Cp (Within sample elbow-room metric)

Cpk: Cpk (Within sample centering metric)

Pp: Pp (Between sample elbow-room metric)

Ppk: Ppk (Between sample centering metric)

LCL: Lower Control Limit

X: Process Center

UCL: Upper Control Limit

Sig: Sigma from control charts

The order given in the vector is the order displayed on the chart. In this case, only Cp and Cpk were selected, as shown below.

Cool! Looks like the process is in good shape. To see more examples of capability analysis, checkout the ggQC documentation and examples on stat_QC_Capability. stat_QC_Capability is also compatible with ggplot faceting. Note that XbarR capability charts are specified slightly different than XmR.

Pareto Analysis

Alright, so your processes are in control. However, you know your process has bottlenecks. Where should you start? One way to help plan your attack is with a Pareto analysis. Suppose you have the following data showing how long several typical process steps take.

To generate a Pareto chart, load the data, initialize ggplot, and let the stat_pareto() command do the rest.

Looks like our next improvement project will focus on either shipping or order fulfillment. Good Luck!

Summary

Building control charts with ggQC is quick and easy, especially if you're already familiar with ggplot. Like other ggplot graphs, ggQC control charts support faceting and are built up layer-by-layer. If you need to make a complicated chart, go ahead. You can add as many stat_QC calls as you like (see XbarR_Vignette). In addition to control charting, ggQC allows you to run Pareto, capability, and Shewart violation analysis. To learn more, please visit rcontrolcharts.com