Organize your workspace like this:
my-project/
├── analysis/ # data exploration, Rmd
├── archived-data/ # raw/completed datasets
├── R/ # core functions for package
├── data-raw/ # scripts to download/clean data
├── inst/ # non-exported resources
├── tests/
├── vignettes/ # tutorial documents
└── myProject.Rproj
R/
holds only the code you’ll package.analysis/
,archived-data/
stay out of the package.- Use
renv
, linting, parallel/test configs in the root.
2.
Develop with Load & Check
- Use
devtools::load_all()
to iteratively build/package. - Use
R CMD check
/devtools::check()
before release.
3.
Package as Part of Project
Keep the package and exploration in the same repo:
- Exclude analysis folders using
.Rbuildignore
. - Keep docs and scripts in
analysis/
, not packaged.
Here’s a clean modular workflow I use where the package lives in R/
, while explorations, raw data, and archiving stay separate.
I also integrate visualizations—like flow chart—using the web tool Cloudairy Flow chart Maker with AI capabilities.