From tlab
End-to-end R data analysis workflow from exploration through regression to publication-ready tables and figures
How this skill is triggered — by the user, by Claude, or both
Slash command
/tlab:data-analysis [dataset path or description of analysis goal][dataset path or description of analysis goal]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Run an end-to-end data analysis in R: load, explore, analyze, and produce publication-ready output.
Run an end-to-end data analysis in R: load, explore, analyze, and produce publication-ready output.
Input: $ARGUMENTS -- a dataset path (e.g., data/raw/county_panel.csv) or a description of the analysis goal (e.g., "regress wages on education with state fixed effects using CPS data").
r-code-conventions rule -- loaded automatically from user level)code/ with descriptive namesoutput/saveRDS() for every computed object.claude/rules/)r-code-conventions rule for coding standardslibrary(), never require()). Always include library(rio)
— it is the project default for data import/export (per AGENTS.md § R Data Conventions).set.seed(42); delimiter, , decimal). Check encoding and delimiter:
readLines(path, n = 3) # eyeball the first 3 lines
rio::import(), passing explicit sep =, dec =, and encoding = when the
inspection reveals non-default conventions. Run janitor::clean_names() after import if
column names contain whitespace or non-ASCII characters.Generate diagnostic outputs:
summary(), missingness rates, variable typesSave all diagnostic figures to output/diagnostics/.
Based on the research question:
fixest for panel data, lm/glm for cross-sectionTables:
modelsummary for regression tables (preferred) or stargazer.tex for LaTeX inclusion and .html for quick viewingFigures:
ggplot2 with project themebg = "transparent" in ggsave()ggsave(width = X, height = Y).pdf and .pngsaveRDS() for all key objects (regression results, summary tables, processed data)output/ subdirectories as needed with dir.create(..., recursive = TRUE)renv::status() # see what changed
renv::snapshot() # update renv.lock — required by AGENTS.md § Git Rules
Then stage renv.lock for the next commit.Delegate to the r-reviewer agent:
"Review the script at code/[script_name].R"
Follow this template:
# ============================================================
# [Descriptive Title]
# Author: [from project context]
# Purpose: [What this script does]
# Inputs: [Data files]
# Outputs: [Figures, tables, RDS files]
# ============================================================
# 0. Setup ----
library(tidyverse)
library(rio) # project default for data I/O
library(janitor) # clean_names() for messy column headers
library(fixest)
library(modelsummary)
set.seed(42)
dir.create("output/analysis", recursive = TRUE, showWarnings = FALSE)
# 1. Data Loading ----
# Inspect first, then import. Many Turkish/European CSVs use ; and , (decimal).
# readLines("data/raw/example.csv", n = 3)
# df <- rio::import("data/raw/example.csv", sep = ";", dec = ",", encoding = "UTF-8") |>
# janitor::clean_names()
# 2. Exploratory Analysis ----
# [Summary stats, diagnostic plots]
# 3. Main Analysis ----
# [Regressions, estimation]
# 4. Tables and Figures ----
# [Publication-ready output]
# 5. Export ----
# [saveRDS for all objects, ggsave for all figures]
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub tasdemir-lab/tlab-research --plugin tlab