R Project Structure
A scalable and maintainable folder structure for R applications
File Structure
- R
- 01_data_import.R
- 02_data_cleaning.R
- 03_exploratory_analysis.R
- 04_modeling.R
- 05_visualization.R
- functions.R
- utils.R
- data
- raw
- processed
- external
- interim
- output
- figures
- tables
- models
- docs
- analysis_report.Rmd
- methodology.Rmd
- references.bib
- tests
- testthat
- testthat.R
- man
- functions.Rd
- DESCRIPTION
- NAMESPACE
- main.R
- config.R
- .Rbuildignore
- .gitignore
- README.md
Directory Structure Explanation
R/03_exploratory_analysis.R
Exploratory data analysis script for initial data investigation.
R/04_modeling.R
Statistical modeling and machine learning script.
R/utils.R
Utility functions for common operations and helper methods.
data/interim/
Intermediate data files created during processing steps.
output/models/
Saved statistical models and machine learning objects.
tests/
Unit tests for custom functions using the testthat framework.
man/
Documentation files for functions when building an R package.
DESCRIPTION
Package metadata file when the project is structured as an R package.
NAMESPACE
Defines which functions are exported when building an R package.
.Rbuildignore
Specifies files to ignore when building an R package.