datascience

Create R Package

Readings

Lesson

  1. Developing R Packages with RStudio
  2. Building, Testing, and Distributing Packages
  3. Writing Package Documentation
  4. Writing documents for R package

R package checklist

  1. Check out (clone) the package repository as a RStudio project or create a R package project from RStudio menu File/New Project…;
  2. Test that the pakcage builds and loads without issue;
  3. Check the package with devtools::check(), which also runs tests inlcuded in the package; verify there are no errors or warnings;
  4. Does the package include tests? Do the tests run successfully?
  5. Verify that the package includes proper documents as roxygen comments in the R code files;
  6. (Does the package include vignettes?)
  7. Install the package and load it with library;
  8. See what functions are provided by the package with ls("package:<package name>") after loading it with library;
  9. Study the vignettes and help documents to learn how to use it.

Exercise

Re-organize the function(s) you developed in the R coding basics section into a R package:

Learning more

  1. R Package by Hadley Wickham
  2. Making Your First R Package by Fong Chun Chan
  3. A Quickstart Guide for Building Your First R Package