Awesome-Agent-Skills-for-Empirical-Research data-analysis
End-to-end R data analysis workflow from exploration through regression to publication-ready tables and figures.
install
source · Clone the upstream repo
git clone https://github.com/brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/14-luischanci-claude-code-research-starter/dot-claude/skills/data-analysis" ~/.claude/skills/brycewang-stanford-awesome-agent-skills-for-empirical-research-data-analysis-b6627c && rm -rf "$T"
manifest:
skills/14-luischanci-claude-code-research-starter/dot-claude/skills/data-analysis/SKILL.mdsource content
Data Analysis
Run an end-to-end data analysis in R through 5 phases.
Phase 1: Setup and Data Loading
- Read R code conventions from
.claude/rules/r-code-conventions.md - Create script with proper header (title, author, purpose, inputs, outputs)
- Load packages with
(neverlibrary()
)require() - Set
if stochastic elements are involvedset.seed() - Load data using relative paths
Phase 2: Exploratory Data Analysis
- Summary statistics (mean, sd, min, max, N)
- Missingness patterns
- Distributions of key variables
- Bivariate relationships
- Time patterns (if panel data)
- Group comparisons
- Save diagnostics to
output/diagnostics/
Phase 3: Main Analysis
- Use
for panel data with fixed effects (seefixest
for detailed patterns)/econometrics-r - Use
/lm
for cross-sectionglm - Cluster standard errors appropriately
- Run multiple specifications (simple to complex)
- Report both statistical and economic significance
- For causal inference (IV, DiD, RDD), see
for diagnostics and modern estimators/causal-inference-r - For spatial econometrics, see
for/econometrics-r
/spdep
patternsspatialreg
Phase 4: Publication-Ready Output
- Tables:
(preferred) ormodelsummary
, export asstargazer
and.tex.html - Figures:
with project theme, explicit dimensions, white background, 300 DPIggplot2 - Export figures as
and.pdf.png
Phase 5: Save and Review
for all computed objectssaveRDS()- Run r-reviewer agent on generated script
- Address Critical/High issues
Script Structure Template
# ============================================================================== # Title: [Analysis Name] # Author: [Name] # Date: [YYYY-MM-DD] # Purpose: [What this script does] # Inputs: [Data files] # Outputs: [Tables, figures, RDS files] # ============================================================================== # 0. Setup ---- library(tidyverse) library(fixest) library(modelsummary) # 1. Data Loading ---- # 2. Exploratory Analysis ---- # 3. Main Analysis ---- # 4. Tables and Figures ---- # 5. Export ----
All scripts saved to
scripts/R/, all outputs to output/.