Errors and updates

Chapman and Hall/CRC published this book in July 2023. You can purchase that here.

This online version has some updates to what was printed. An online version that matches the print version is available here.

Last updated: 3 April 2024.

Since the publication of this book in July 2023, there have been a variety of changes in the world. The rise of generative AI has changed the way that people code, Python has become easier to integrate alongside R because of Quarto, and packages continue to update (not to mention a new cohort of students has started going through the book). One advantage of having an online version is that I can make improvements.

I am grateful for the corrections and suggestions of: Andrew Black, Clay Ford, Crystal Lewis, David Jankoski, Donna Mulkern, Emily Su, Inessa De Angelis, James Wade, Julia Kim, Krishiv Jain, Seamus Ross, Tino Kanngiesser, and Zak Varty.


The following errors exist in the print version, but have been updated in the online version. If you notice an error not mentioned below, please submit an issue or send an email:

    1. xxi: Add Alex Hayes to the Acknowledgments.
  • p. 20: Add “packages” to “use the tidyverse and janitor packages.”
  • p. 34: "daily-shelter-overnight-service-occupancy-capacity-2021" should be "daily-shelter-overnight-service-occupancy-capacity-2021.csv" (note the “.csv” added).
  • p. 34: Replace the first code chunk with the second:
toronto_shelters_clean <-
     clean_names(toronto_shelters) |>
     select(occupancy_date, id, occupied_beds)

toronto_shelters_clean <-
  clean_names(toronto_shelters) |>
  mutate(occupancy_date = ymd(occupancy_date)) |> 
  select(occupancy_date, occupied_beds)

  • p. 38: “At this point we can make a nice graph of the number of ridings won by each party in the 2019 Canadian Federal Election.” should refer to the 2021 election.
  • p. 41: Remove a stray “:::”.
  • p. 66: “New Project$dots” should be “New Project…”.
  • p. 138: scale_color_brewer(palette = "Set1") is unnecesary and should be removed.
  • p. 138: The figure caption should refer to inflation not unemployment.
  • p. 154: Q9 is missing a “work” after the code chunk and before the “if”.
  • p. 342: Q5 option b is repeated in option c.
  • p. 347: The “Exploratory data analysis” chapter of R for Data Science is 11, not 12.
  • p. 353: Fix a “the the”.
  • p. 355: “…results in an estimate of 5,814, both of which are too low.” should be “…results in an estimate of 11,197, the former is too low and the latter is too high.”
  • p. 371: The sentence that references Figure 11.11a was confusing and needs to more clearly reference the figure.
  • p. 587: The link should be:


While I have tried to limit changes to what was printed, the following have been made:


  • Updated links and citations for: Barrett (2021); Blair (2019); Chase (2020); Kasy and Teytelboym (2023); and World Health Organization (2019).


  • Added a reference to Matsumoto (2007).


  • Updated links and citations for: Barrett (2021).


  • Updated links and citations for: Barrett (2021), again.
  • Alberta updated their COD file so that it now needs a skip.


  • Mentioned Python in the Introduction.
  • Adding Prediction as a chapter.
  • Updated from get_stamenmap() to get_stadiamap().


  • Moved DAGs to the writing research chapter.