I need your help!

If you find any typos, errors, or places where the text may be improved, please let me know. The best ways to provide feedback are by GitHub or hypothes.is annotations.

Opening an issue or submitting a pull request on GitHub

Hypothesis Adding an annotation using hypothes.is. To add an annotation, select some text and then click the on the pop-up menu. To see the annotations of others, click the in the upper right-hand corner of the page.


Cover image

This book contains the exercise solutions for the book R for Data Science, by Hadley Wickham and Garret Grolemund (Wickham and Grolemund 2017).

R for Data Science itself is available online at r4ds.had.co.nz, and physical copy is published by O’Reilly Media and available from amazon.


These solutions have benefited from many contributors. A special thanks to:

  • Garrett Grolemund and Hadley Wickham for writing the truly fantastic R for Data Science, without whom these solutions would not exist—literally.
  • @dongzhuoer and @cfgauss for careful readings of the book and noticing numerous issues and proposing fixes.

Thank you to all of those who contributed issues or pull-requests on GitHub (in alphabetical order): @adamblake, @benherbertson, @bhishanpdl, @bob100000000000, @carajoos, @chrisyeh96, @clemonsa, @daczarne, @dcgreaves, @decoursin, @dependabot[bot], @dongzhuoer, @dvanic, @edavishydro, @eric-k-zhu, @GoldbergData, @gvwilson, @henrikmidtiby, @ihagerman, @JamesCuster, @jdblischak, @jhoeting, @jlbeaudry, @jmclawson, @kxchia1, @liuminzhao, @lopierra, @martinruhle, @matthewlock91, @mgeard, @mjones01, @mroviras, @mugpeng, @mvhone, @neander09, @nickcorona, @nielsenmarkus11, @nzxwang, @qichun-dai, @r2ressler, @RandallEW, @rbjanis, @ricardosasso, @Shurakai, @TheMksConnection, @timothydobbins, @tinhb92, @vzei, @xiaoouwang, @xinrui112, and@zidra Thank you to all of you who contributed annotations on hypothes.is (in alphabetical order): @electricdinosaurs, and @inkish.

For another set of solutions for and notes on R for Data Science see Yet Another ‘R for Data Science’ Study Guide by Bryan Shalloway.


This work is licensed under a Creative Commons Attribution 4.0 International License.


Wickham, Hadley, and Garrett Grolemund. 2017. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. 1st ed. O’Reilly Media.