Control chart in R

I use the officer package to export to PowerPoint. We're pretty far afield from your original question. If you have further questions on exporting objects to PowerPoint, I suggest posting a new question so that your audience isn't limited to those familiar with control charts.

2 Likes

Thank you, sure will do so Galangjs

Thank you Galangjs, any idea how we can specify number of points to be displayed in x-axis in qic(qicharts library). Number of data points in x-axis, example to display date variable in x axis. currently I am getting only 3 dates in x axis. I want to display atleast 6 months in x axis . T

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