My devtools cheatsheet

Summary

Quick-reference for the {devtools} workflow when developing R packages: load, document, test, check, build, install, and publish a pkgdown site.


Commands

TaskCommand
Load all functions without installingdevtools::load_all()
Generate .Rd docs from roxygen2 commentsdevtools::document()
Run tests interactivelydevtools::test()
Run R CMD checkdevtools::check()
Build the package tarballdevtools::build()
Install the package locallydevtools::install()
Set up a pkgdown site (one-off)usethis::use_pkgdown()
Build the pkgdown sitepkgdown::build_site()

Typical inner-loop order

  1. Edit code or roxygen comments.
  2. devtools::document() — regenerate .Rd files and NAMESPACE.
  3. devtools::load_all() — pick up changes without reinstalling.
  4. devtools::test() — run the test suite.
  5. devtools::check() — full R CMD check before committing.