My devtools cheatsheet
Summary
Quick-reference for the
{devtools}workflow when developing R packages: load, document, test, check, build, install, and publish apkgdownsite.
Commands
| Task | Command |
|---|---|
| Load all functions without installing | devtools::load_all() |
Generate .Rd docs from roxygen2 comments | devtools::document() |
| Run tests interactively | devtools::test() |
Run R CMD check | devtools::check() |
| Build the package tarball | devtools::build() |
| Install the package locally | devtools::install() |
Set up a pkgdown site (one-off) | usethis::use_pkgdown() |
Build the pkgdown site | pkgdown::build_site() |
Typical inner-loop order
- Edit code or roxygen comments.
devtools::document()— regenerate.Rdfiles andNAMESPACE.devtools::load_all()— pick up changes without reinstalling.devtools::test()— run the test suite.devtools::check()— fullR CMD checkbefore committing.
LINKS
devtools— https://devtools.r-lib.org/pkgdown— https://pkgdown.r-lib.org/- R Packages (Wickham & Bryan) — https://r-pkgs.org/