Author

Vagish Hemmige

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/                    # Local render of the website (ignored; published to gh-pages)
  β”œβ”€β”€ <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.R sources 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.R and R/figures.R may 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.