How to scaffold a proper R package
When to use: You're tired of hand-writing DESCRIPTION, NAMESPACE, and roxygen2 boilerplate.
Flow
-
ScaffoldUse Posit R-package skill. Create a new package 'tidylaundry' with 2 exported functions: wash() and fold().✓ Copied→ Directory with DESCRIPTION, NAMESPACE, R/, tests/testthat/, README
-
Add roxygenAdd roxygen2 docs with @param, @return, @examples for each function.✓ Copied→ Inline docs that devtools::document() converts to man/
-
Smoke testWrite testthat tests covering happy path + one edge case each.✓ Copied→ Tests passing under devtools::test()
Outcome: A package that passes R CMD check on day one.
Pitfalls
- Generated code uses base R where tidyverse would be clearer (or vice versa) — State the style preference upfront