liveBook · Manning

ggQC

As explained in Statistics Slam Dunk

ggQC is an R package for creating quality-control charts and related statistical process-control graphics with ggplot2.

ggQC is an R package for creating quality-control charts with ggplot2. Its Pareto-chart functionality combines bars for category counts with a cumulative-percentage line on a secondary axis. section 15.4.1

A practical ggQC workflow includes:

  • Prepare the data with dplyr before passing it to ggplot(). section 15.4.1
  • Use stat_pareto() to add the cumulative-percentage line automatically. section 15.4.1
  • Sequence categories before plotting so the x-axis labels appear correctly. section 15.4.1

NBA franchise games

Filter out child records to retain 47 past and present franchises, then group by franchise and plot games played. The resulting Pareto chart compares each franchise’s games with the cumulative share across all franchises. section 15.4.1

df4 %>%
 group_by(franchise) %>%
 summarize(games) %>%
ggplot(aes(x = franchise, y = games)) +
       theme(axis.text.x = element_text(angle = 90, 
                                        hjust = 1, vjust = 0.5)) +
       stat_pareto() +
 ggtitle("Pareto Chart: Games Played (1946-2020)") +
 xlab("") +
 ylab("Games Played") +
 theme(plot.title = element_text(face = "bold"))

Inspect the complete ggplot2 pipeline using stat_pareto(), rotated franchise labels, and a descriptive title. section 15.4.1

How Statistics Slam Dunk covers it

How deep it goes
Demonstrates data filtering, grouping, plotting, label formatting, and stat_pareto(), but does not detail package internals.
Examples
Uses NBA franchise games, active and inactive franchise counts, and a 47-category Pareto visualization.
What you can do after
Builds Pareto charts in R with ggplot2 and ggQC after preparing and ordering grouped data.
How it connects
Connects ggplot2, dplyr, Pareto charts, secondary axes, and quality-control charts.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.