Quantcast
Viewing all articles
Browse latest Browse all 48330

Re: R Control Chart

Sorry for late response. For the sake of simplicity, I mainly used mock data which I entered
manually. The idea was basically to create a series of 4 weeks subsets over a 12 months period sort if thing...
We both agree that a real life scenario would have gone through a much fancier scenario such as querying data
from a server and even adding conversion at some stage. I used numeric for simplicity.

Also I noticed that even if qcc library offers a wide variety of statisitic chart [R, xBar,...], it doesn't seem to have
any qcc - y axis formatting options parameter as you would probably find using scaling_y_continuous in ggplot2 library.
So in this case I don't believe y axis percentage formatting could be done in one shot.

 

My best bet would be to define the qcc : q1 R Chart and q2 xBar  in respectice class with a plot=False attribute

 library(qcc)
 Jan <- c(0.837742,0.839917,0.728918,0.729828) # Fill in subgroup January data!
 Feb <- c(0.783877,0.807215,0.841566,0.836107) # Fill in subgroup February data!
 Mar <- c(0.813634,0.728839,0.742498,0.831201) # Fill in subgroup March data!
 Apr <- c(0.745943,0.803432,0.830168,0.798949) # Fill in subgroup April data!
 May <- c(0.688624,0.726905,0.717450,0.784127) # Fill in subgroup May data!
 Jun <- c(0.787875,0.783185,0.714186,0.814055) # Fill in subgroup June data!
 Jul <- c(0.726711,0.784376,0.805309,0.749184) # Fill in subgroup July data!
 Aug <- c(0.812219,0.797509,0.722367,0.871223) # Fill in subgroup August data!
 Sep <- c(0.878350,0.812981,0.881944,0.768875) # Fill in subgroup September data!
 Oct <- c(0.832196,0.768824,0.799608,0.729053) # Fill in subgroup October data!
 Nov <- c(0.813634,0.728839,0.742498,0.831201) # Fill in subgroup November data!
 Dec <- c(0.726711,0.784376,0.805309,0.749184) # Fill in subgroup December data!
 # Include those subgroups into a my.data mock list through rbind
 dataset <- rbind(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)
 months<- c("Jan", "Feb", "Mar", "Apr","May", "Jun","Jul","Aug","Sep","Oct","Nov","Dec") 
# assign q1 q1 <- qcc(dataset, type="R", nsigmas=1, labels=months, xlab= "Month", ylab = "Service Level %", title = "Phone Call SVL", digits=3, label.limits = c("5%", "14%"),plot=FALSE) # assign q2
q2 <- qcc(dataset, type="xbar", nsigmas=1, labels=months, xlab= "Month", ylab = "Service Level %", title = "Phone Call SVL", digits=3, label.limits = c("76%", "80%"), plot=FALSE)

and then use each q1& q2 with a plot method allowing to erase the y axis and redifine a new one with somekind of thicks. 

plot(q1, yaxt="n", ... , xlab="Months", ylab="Service Levels %", title="Phone Call SVL", label.limits= c("5%", "13%"))

Image may be NSFW.
Clik here to view.
RChart.png

plot(q2, yaxt="n", ...,  xlab="Months", ylab="Service Levels %", title="Phone Call SVL", label.limits= c("76%", "80%"))

Image may be NSFW.
Clik here to view.
xBar.png

Tom Hopper has written a blog on rewriting qcc plot using ggplot2 and grid,
  https://tomhopper.me/2014/03/03/rewriting-plot-qcc-using-ggplot2-and-grid/

though I haven't got a chance to dive deep into it. I wish I could bring you an easiy solution on y axis percentage formatting
though I haven't found one with qcc. Sorry.

 

 


Viewing all articles
Browse latest Browse all 48330

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>