Error when trying to create a pareto chart in an rmd file

337 Views Asked by At

I'm trying to create a pareto chart (from the qcc package) in an r markdown file.

bondfailures <- read.csv("BondFailures.csv", header = T)
totalbondfailures <- bondfailures$Total
names(totalbondfailures) <- c("Degrease", "Chemical Treatments", "Incompatability", "Bad Storage", "Bad Refrigeration", "Bad Rolling", "Curling Temp", "Curling Humidity")
par("mar")
pareto.chart(totalbondfailures, ylab="Frequency", xlab="Defect Category", main="Pareto Diagram of Total Number of Failures by Defect Category")

It's reading in the data ok, but when I try to create the pareto chart I get the following error message:

Error in par(bg = qcc.options("bg.margin"), mar = pmax(par("mar") + mar,  : 
  invalid value specified for graphical parameter "mar"

What am I doing wrong?

1

There are 1 best solutions below

1
On

This might have occurred due to NA values present in the dataset. Use na.omit(bondfailures) to remove NA and pareto.chart will work fine!