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.
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.
How this book is organized
The book is divided into sections in with the same numbers and titles as those in R for Data Science. Not all sections have exercises. Those sections without exercises have placeholder text indicating that there are no exercises. The text for each exercise is followed by the solution.
Like R for Data Science, packages used in each chapter are loaded in a code chunk at the start of the chapter in a section titled “Prerequisites”. If exercises depend on code in a section of R for Data Science it is either provided before the exercises or within the exercise solution.
If a package is used infrequently in solutions it may not be loaded, and functions using it will be called using the package name followed by two colons, as in
dplyr::mutate() (see the R for Data Science Introduction).
The double colon may also be used to be explicit about the package from which a function comes.
Additional, the solutions use several packages that are not used in R4DS. You can install all packages required to run the code in this book with the following line of code.
If you find any typos, errors in the solutions, have an alternative solution, or think the solution could be improved, I would love your contributions. The best way to contribute is through GitHub. Please open an issue at https://github.com/jrnold/r4ds-exercise-solutions/issues or a pull request at https://github.com/jrnold/r4ds-exercise-solutions/pulls.
HTML and PDF versions of this book are available at https://jrnold.github.io/r4ds-exercise-solutions. The book is powered by bookdown which makes it easy to turn R markdown files into HTML, PDF, and EPUB.
This book was built with these R packages.
devtools::session_info("r4ds.exercise.solutions") #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.0 (2020-04-24) #> os Ubuntu 16.04.6 LTS #> system x86_64, linux-gnu #> ui X11 #> language en_US.UTF-8 #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz UTC #> date 2020-07-19 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> ! package * version date lib source #> R r4ds.exercise.solutions <NA> <NA> [?] <NA> #> #>  /home/travis/R/Library #>  /usr/local/lib/R/site-library #>  /home/travis/R-bin/lib/R/library #> #> R ── Package was removed from disk.