Jin Jin - 1 year ago 139
R Question

Issue with pcr in qualityTools

I've encountered an issue when using the pcr function in qualityTools to plot the process capabilities

x = rweibull(1000, 2, 8) + 1000
pcr(x, "weibull", lsl = 100, usl = 117)

The histogram background is covered with numbers! Not sure what went wrong. Can somebody please take a look?


The histogram background is covered with numbers!

Answer Source

You can fix this by calling pcr with the argument xlab = "", i.e.

pcr(x, "weibull", lsl = 100, usl = 117, xlab = "")

Explanation. An inspection of pcr shows that it is calling hist using do.call in the following way:

do.call(hist, c(list(x[, 1], freq = FALSE, xlim = xlim, ylim = ylim, main = ""), parList))        

This construct creates a name for the input that concatenates all the values of the vector. This name is then displayed as the x-axis label. You can replicate this behavior by calling, e.g.

do.call(hist, c(list(rnorm(3), main = "")))

The solution is to set xlab = "".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download