Errata

General note. R packages often change their computation algorithms, function names, and requirements. If your code doesn't work or the output doesn't match what is shown in the book, see Section 1.6.2 in the book for notes and ideas.

Specific errata and package update notes

Page Change
145 Thanks to Ada Suhkyung Kim for this note. The plot of rating proportions now gives a warning from ggplot2:

> ggplot(aes(x=Rating), data=csat.month) +
+   geom_bar(aes(y=(..count..)/sum(..count..))) +
+   scale_y_continuous(labels=percent_format()) +
+   xlab("Rating on 1-5 Scale") +
+   ylab("Percent of Users Giving Rating") +
+   ggtitle(paste0("Satisfaction Ratings, Oct 2021 (N=",
+                  nrow(csat.month), ")"))
Warning message:
The dot-dot notation (`..count..`) was deprecated in ggplot2 3.4.0. 
Please use `after_stat(count)` instead.

The problem is in the second line of the chunk, which uses a now-obsolete shorthand to reference the underlying statistics (in this case, the per-rating counts) that are generated by functions such as geom_bar().

To resolve the warning, replace "..count.." with "after_stat(count)". Specifically, that occurs in two places in the second line of the code snippet:

ggplot(aes(x=Rating), data=csat.month) +
  geom_bar(aes(y=(after_stat(count))/sum(after_stat(count)))) +
  scale_y_continuous(labels=percent_format()) +
  xlab("Rating on 1-5 Scale") +
  ylab("Percent of Users Giving Rating") +
  ggtitle(paste0("Satisfaction Ratings, Oct 2021 (N=",
                 nrow(csat.month), ")"))

As an editorial note, such minor changes occur frequently with tidyverse components such as ggplot2; it is a rapidly evolving set of tools that amount to almost a second language built on top of R. (Elea Feit and I say more about that in the section, "Which R?" in Chapter 1 of R for Marketing Research and Analytics.)

Bug reports

What How
Report a suspected bug
Include the chapter and page, with a reproducible example.
email: quantuxbook@gmail.com