I am using cchart.p function of IQCC package to generate p-charts, but title of the graph is "Standardized p-chart (phase II)".
I want to change the title and axes label names.
Code tried:
library(IQCC)
#get arguments
args <- commandArgs(TRUE)
pdfname <- args[1]
datafile <- args[2]
pdf(pdfname)
tasks <- read.csv(datafile , header = T,sep=",")
p <- cchart.p(x1 = tasks$x, n1 = tasks$y,phat = 0.02)
print(p)
dev.off()
Any function or package I can use with it?
How I can use with ggplot2 package?
In
IQCCpackage the functioncchart.pdoes not permit arguments to change title and/or axis labels. However you can modifycchart.pcode itself. In the body of the function there are calls forqccfunction, which has argument to change title and axes labels. Please see the code below for modifiedcchart.p(the changes for title and labels are indicated by comments):The excerpt below shows the only part which is changed in the function
cchart.p2in comaprison with initial functioncchart.p:Then you can call the modified function:
And get desired output:
As for
ggplot2usage, you need to extract information about upper & lower control limits and central line fromqccobject. Please see the code below.Output: