R package development series
From a first package to classes and compiled code
How to build an R package, in the order you’ll need each part: from a folder of scripts to a package that installs, documents itself and passes R CMD check, then clear errors, data and side effects, sharing and deprecation, and finally object systems and compiled code. It links to the Foundations, Testing and Pharma posts instead of repeating them. New posts are added as they’re written.
Parts in this series
| # | Part | Published |
|---|---|---|
| 01 | From scripts to a package
Move reusable analysis helpers from sourced scripts into a minimal R package, and replace workspace pollution with the devtools::load_all() loop.
Published 2026-09-29 |
2026-09-29 |
| 02 | The package development loop and R CMD check
Use the R package development loop, read R CMD check diagnostics, and fix four recurring problems.
Published 2026-09-29 |
2026-09-29 |
| 03 | Dependencies: DESCRIPTION and NAMESPACE
Declare external packages in DESCRIPTION Imports and Suggests, call functions through pkg::fun() or @importFrom, and guard optional dependencies cleanly.
Published 2026-09-29 |
2026-09-29 |
| 04 | Documenting functions with roxygen2
Generate man/*.Rd documentation and NAMESPACE exports directly from inline roxygen2 blocks, and keep examples executable in R CMD check.
Published 2026-09-29 |
2026-09-29 |
More articles in this series are on the way.
No matching items