R Analysis Repository Blueprint
Intended file organization for an R research analysis. ARCHITECTURE.md, maintained through Posit, describes the current implementation.
repository/
βββ R/
β βββ main.R # Orchestrates definitive analysis
β βββ setup.R # Packages, paths, shared parameters
β βββ functions.R # Reusable functions
β βββ ... # Study-specific scripts and subdirectories
β βββ tables.R # Generates or orchestrates tables
β βββ figures.R # Generates or orchestrates figures
βββ figures/ # Generated figures
βββ tables/ # Generated tables
βββ references/ # Supporting literature and evidence
βββ quarto/ # Explanatory Quarto pages
βββ _extensions/ # Quarto extensions, when used
βββ docs/ # Example rendered website directory
βββ <project>.Rproj # Optional RStudio project file
βββ _quarto.yml # Quarto configuration
βββ index.qmd # Website entry point
βββ README.md # Overview and execution
βββ README.Rmd # Optional source for README.md
βββ analysis-plan.md # Scientific objectives and methods
βββ references.bib # Bibliographic citations
βββ AGENTS.md # Agent instructions
βββ ARCHITECTURE.md # Current implementation (Posit)
βββ REPOSITORY-BLUEPRINT.md # Intended organization
βββ .gitignore # Project-specific exclusions
Analytical scripts
R/main.Rsources definitive scripts in dependency order.- Typical workflow: setup β cohort construction β processing β modeling β outputs.
- Study-specific scripts may be grouped into subdirectories by analytical stage.
R/tables.RandR/figures.Rmay generate outputs directly or orchestrate specialized scripts.
Documentation
- Document definitive analytical scripts with explanatory Quarto pages; exploratory scripts need not have pages.
- Use Cryptococcus-cost-analysis as an example for Quarto supporting files, chunk imports, callouts, and formattingβnot scientific methods.
- Quarto source and rendered output locations may vary by project.
Outputs and version control
- Track approved, nonrestricted outputs when useful for publication; otherwise retain them locally and exclude them from Git.
.gitignore: Exclude restricted data, credentials, caches, temporary files, and generated outputs unless intentionally tracked (e.g.,.Rproj.user/,.Rhistory,.RData,.httr-oauth,.quarto/,cache/,figures/,tables/,*.quarto_ipynb); verify exclusions cover actual output paths without hiding necessary source or reference files.