1

I like using the R package qcc. This is a great package for the quality control professional. The package generates a lot of cool graphics. I know how to modify basic graphs in R with the par() command.

The graphics in the qcc package are somewhat unique and I don't always know what elements make up the graphics. How do I determine what elements make up the graphics so I can modify them with the par() commands and arguments. Take this simple cause and effect diagram in the code below. How would I go about modifying line colors, line thicknesses, font, etc? I have no idea how the author constructed this when they developed the package.

library(qcc)
cause.and.effect(cause=list(Measurements=c("Micrometers", "Microscopes",    "Inspectors"),
Materials=c("Alloys", "Lubricants", "Suppliers"),
Personnel=c("Shifts", "Supervisors", "Training", "Operators"),
Environment=c("Condensation", "Moisture"),
Methods=c("Brake", "Engager", "Angle"),
Machines=c("Speed", "Lathes", "Bits", "Sockets")),
effect="Surface Flaws")

The following capability analysis should be a little more familiar to the normal R user. How do I modify the three vertical red lines in this graphic? Perhaps I want to use a different color, different line style/thickness, etc. And again, how do I determine what elements make up the graphic so I can modify any particular part of it if I so wish?

library(qcc)
data(pistonrings)
attach(pistonrings)
diameter <- qcc.groups(diameter, sample)
q <- qcc(diameter[1:25,], type="xbar", nsigmas=3, plot=FALSE)
process.capability(q, spec.limits=c(73.95,74.05))
Display name
  • 4,153
  • 5
  • 27
  • 75
  • 3
    If you need that level of control for a specific function in a specific package, you're going to be probably have to [read the function source code](https://stackoverflow.com/questions/19226816/how-can-i-view-the-source-code-for-a-function). There aren't always options to control every setting. You may need to create your own version of the function. – MrFlick Jul 14 '17 at 02:28
  • 1
    You might have an easier time if you for the repo, edit source code to your liking and install your version. Many functions depend on internal functions that are not exported and they will be a pain to deal with if you just copy code for a single function and try to fiddle with that. Remember CRAN is mirrored on github https://github.com/cran/qcc/blob/11b6ecef027c315ed547e4749949ee3a7eed502c/R/causeandeffect.R – OganM Jul 14 '17 at 03:07

0 Answers0