Control chart in R

I realise this is a long time since the original post, but here are some pointers for some of the issues you have

Excluding out of control points - you can exclude the out of control points using the exclude parameter of the qic function in qicharts2.
From the function help , exclude is an : "Integer vector indicating data points to exclude from calculations of centre and control lines."
For example, exclude =c(39:52)

Looping through columns and plotting individual charts - you can create individual charts by using the facet argument within the qic function.

e.g. facet = ~ supplier.
See the package vignette for further examples.

Finally, to increase the number of points/ labels on the date axis, you can assign your original plot to a variable, and then use reguar ggplot2 sytax

p <- qic(Failed,
            n=Built,
            x=DateMonth,
            data=df1,
             exclude = c(39:43), # exclude these points from calculations
            # facets = ~ supplier, # facet chart by supplier
            show.labels = TRUE,
            multiply = 1000000,
            chart='u',

p <- p + ggplot2::scale_x_date(labels = scales::date_format("%Y-%m"),
                                                         breaks = "2 months")
 p

You should also look at the x.period and x.format arguments in the qic function, though I find it easier to assign the original plot to a variable, and then refine using ggplot2

1 Like