CanofDrink - 1 year ago 114

R Question

I need to remove the lower control limit and center line (and their labels) from my control chart.

Here's the code:

`# install.packages('qcc')`

library(qcc)

nonconforming <- c(3, 4, 6, 5, 2, 8, 9, 4, 2, 6, 4, 8, 0, 7, 20, 6, 1, 5, 7)

samplesize <- rep(50, 19)

control <- qcc(nonconforming, type = "p", samplesize, plot = "FALSE")

warn.limits <- limits.p(control$center, control$std.dev, control$sizes, 2)

par(mar = c(5, 3, 1, 3), bg = "blue")

plot(control, restore.par = FALSE, title = "P Chart for Medical Insurance Claims",

xlab = "Day", ylab = "Proportion Defective")

abline(h = warn.limits, lty = 3, col = "blue")

v2 <- c("LWL", "UWL") # the labels for warn.limits

mtext(side = 4, text = v2, at = warn.limits, col = "blue", las = 2)

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Not a QC expert by any means but would this work for you? Looking at the qcc function it seems to control what needs to be plotted, so what i've done here is manipulate the limits of the LCL and CENTRE lines. I then changed the plot function to plot between some y limits which does not cover the -1 value. The description unfortunately reflects the manipulated limit values of -1.

```
control$limits[1] <- -1
control$center <- -1
plot(control, restore.par = FALSE, title = "P Chart for Medical Insurance Claims",
xlab = "Day", ylab = "Proportion Defective", ylim=c(0.0,0.4))
```