Skip to content

Instantly share code, notes, and snippets.

@peterhurford
Last active November 7, 2018 19:38
Show Gist options
  • Save peterhurford/defa6e8de765e9d5f93fe110ce67fe87 to your computer and use it in GitHub Desktop.
Save peterhurford/defa6e8de765e9d5f93fe110ce67fe87 to your computer and use it in GitHub Desktop.
"R Packages" by Hadley Wickham, Abridged

R Packages, Abridged

Consider completing "Advanced R, Abridged" and "Git 101 Exercises" first.

"Advanced R" by Hadley Wickham is widely considered the best resource to improve your knowledge at building an R package. This guide is designed to give you the most essential parts of R Packages so that you can get going right away. It still will take a long time, but not as long.

--

  1. Read the following chapters of "R Packages" by Hadley Wickham:

Trivia Exercises

  1. What are the three requirements when naming an R package?
  2. Why is it a bad idea to name your package with a "."?
  3. What is the difference between devtools::install_github and install.packages?
  4. What is the difference between Suggests and Imports?
  5. What is the importance of dontrun?
  6. Why do packages have versions?
  7. What does moving from v1.0.1 to v2.0.0 mean? What does moving from v1.0.1 to v1.0.2 mean?
  8. What does v1.0.1.9000 mean?

Simulation Exercise

Write a package with a function called mean_impute that takes a vector that can contain NAs and returns a vector with the NAs imputed with the mean of that vector. Make your package available open source on your GitHub so people can use it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment