How to render qcc plots to HTML using RMarkdown and knitr

207 Views Asked by At

First SO question so please go easy.

I am running the qcc package with Rstudio and I would like to create a report on the graphs that I am generating. I have no problem generating the graphs and exporting each individual graph to pdf for example. I also have no problem creating a HTML document with RMarkdown and Knitr with other plots. However, with qcc package, I cannot do this! Hopefully someone out there has had this issue and solved.

Here is example from ?qcc that can be used in an RMarkdown file with the issue I am seeing:

data(pistonrings)
attach(pistonrings)
diameter <- qcc.groups(diameter, sample)

    qcc(diameter[1:25,], type="xbar")
    qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,])
    q <- qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], plot=FALSE)
    plot(q, chart.all=FALSE)

Thanks in advance for support.

1

There are 1 best solutions below

0
On

So, I found the reason for this eventually. When function dev.off() is called in the Rmarkdown file then the base plot function will not work!...I didn't include the dev.off() in my question as it was at the top of my script and I hadn't spotted it.

Sorry for the confusion and I hope this helps somebody else.