/r-python-translation
R-to-Python translation for data analysis. Maps R packages (tidyverse, ggplot2, fixest, survey, sf, plm) to Python equivalents (polars, plotnine, pyfixest, svy, geopandas). Use when user has R background or requests R-equivalent code comments.
$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill r-python-translation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/r-python-translation
Context preview
The summary Claude sees to decide when to auto-load this skill.
R-to-Python translation for data analysis. Maps R packages (tidyverse, ggplot2, fixest, survey, sf, plm) to Python equivalents (polars, plotnine, pyfixest, svy, geopandas). Use when user has R background or requests R-equivalent code comments.
SKILL.md
r-python-translation.SKILL.mdname: r-python-translation
description: >-
R-to-Python translation for data analysis. Maps R packages (tidyverse, ggplot2, fixest, survey, sf, plm) to Python equivalents (polars, plotnine, pyfixest, svy, geopandas). Use when user has R background or requests R-equivalent code comments.
metadata:
audience: research-coders
domain: research-methodology
skill-last-updated: "2026-03-28"
R-to-Python Translation Skill
R-to-Python translation reference for quantitative social science data analysis. Maps R ecosystem packages (tidyverse/dplyr, ggplot2, fixest, survey, sf, plm, lme4, marginaleffects, rdrobust) to DAAF Python equivalents (polars, plotnine, pyfixest, statsmodels, linearmodels, svy, geopandas). Use when user mentions R/RStudio background, requests R-equivalent code comments, needs to understand Python analysis code from an R perspective, or wants to translate R data analysis concepts to Python. Covers paradigm differences, verb-by-verb operation translations, regression modeling, causal inference, visualization, and workflow adaptation.
Cross-language translation reference for researchers moving between the R and Python data analysis ecosystems. This skill maps R packages, idioms, and workflows to their DAAF Python equivalents so that R-background users can audit, understand, and learn from DAAF-produced code, and so that code-producing agents can annotate their output with R equivalents when directed.
This skill is a **routing hub** — it provides overview tables, decision trees, and directs readers to the detailed reference files listed below. The reference files contain the exhaustive verb-by-verb mappings, code examples, and edge-case documentation.
What This Skill Does
- Maps the R data analysis ecosystem to DAAF's Python stack across data wrangling, modeling, visualization, causal inference, surveys, spatial analysis, and workflow tooling
- Provides a structured annotation protocol for agents to add inline R-equivalent comments to Python code
- Identifies paradigm gaps where R and Python diverge fundamentally, so users know where to expect friction
**Use cases:**
1. R user auditing DAAF Python code and needing to understand what operations are being performed 2. Agent annotating code with R-equivalent comments for an R-background researcher 3. R user learning Python for data analysis and needing a conceptual bridge 4. Translating a specific R operation or idiom to its Python equivalent 5. Understanding where R tools have no direct Python equivalent (and what the workaround is)
How to Use This Skill
Reference File Structure
Each topic in `./references/` contains focused documentation:
| File | Purpose | When to Read | |------|---------|--------------| | `paradigm-differences.md` | Core language and paradigm differences | Encountering fundamental R-vs-Python confusion | | `polars-dplyr.md` | Core dplyr/tidyr to polars verb mapping (select, filter, mutate, joins, reshaping, window functions, lazy eval) | Reading or writing data manipulation code | | `polars-strings-dates-factors.md` | String, date/time, and factor operations (stringr, lubridate, forcats to polars) | Working with string/date/categorical columns | | `regression-modeling.md` | fixest/stats/plm to pyfixest/statsmodels/linearmodels | Reading or writing regression code | | `visualization.md` | ggplot2/plotly R to plotnine/plotly Python | Reading or writing visualization code | | `causal-inference.md` | R causal inference ecosystem to Python equivalents | Working with DiD, RDD, IV, event studies | | `survey-spatial-ml.md` | survey/sf/tidymodels to svy/geopandas/scikit-learn | Working with surveys, spatial data, or ML | | `workflow-environment.md` | RStudio/Quarto workflow to DAAF/marimo workflow | Adapting to DAAF's execution model | | `external-resources.md` | Curated guides and tutorials with provenance | Seeking additional learning materials | | `gotchas.md` | Common R-user mistakes in Python | Debugging or reviewing code from R perspective |
Reading Order
1. **R user auditing DAAF code:** `paradigm-differences.md` then the relevant domain file (e.g., `polars-dplyr.md` for data wrangling, `regression-modeling.md` for models) then `gotchas.md` 2. **Agent annotating code with R equivalents:** Agent Code Annotation Protocol section below, then the relevant domain file for the code being annotated 3. **Learning Python from R background:** `paradigm-differences.md` then `polars-dplyr.md` then `workflow-environment.md` then `external-resources.md` 4. **Looking up a specific translation:** Quick Decision Trees below, then the relevant reference file
Quick Decision Trees
"How do I do X from R in Python?"
What kind of R operation?
├─ Data wrangling (filter, mutate, join, pivot, summarise)
│ └─ ./references/polars-dplyr.md
├─ Regression / statistical modeling
│ └─ ./references/regression-modeling.md
├─ Plotting / visualization
│ └─ ./references/visualization.md
├─ Causal inference (DiD, RDD, IV, event studies)
│ └─ ./references/causal-inference.md
├─ Surveys / spatial / machine learning
│ └─ ./references/survey-spatial-ml.md
└─ Fundamental language differences (types, syntax, environment)
└─ ./references/paradigm-differences.md"Why does this Python code look different from R?"
What looks unfamiliar?
├─ Expression syntax (pl.col().method().alias())
│ └─ ./references/paradigm-differences.md
├─ Missing values (None vs NaN vs null vs NA)
│ └─ ./references/paradigm-differences.md
├─ Formula interface (~) behaves differently
│ └─ ./references/regression-modeling.md
├─ Import patterns and namespacing
│ └─ ./references/gotchas.md
└─ No interactive REPL / console workflow
└─ ./references/workflow-environment.md"I want to translate an R script to Python"
What does the R script do?
├─ Loads and wrangles data (read_csv, dplyr verbs)
│ └─ ./references/polars-dplyr.md
├─ Runs regressions (lm, feols, plm)
│ └─ ./references/reg
Read more
name: r-python-translation description: >- R-to-Python translation for data analysis. Maps R packages (tidyverse, ggplot2, fixest, survey, sf, plm) to Python equivalents (polars, plotnine, pyfixest, svy, geopandas). Use when user has R background or requests R-equivalent code comments. metadata: audience: research-coders domain: research-methodology skill-last-updated: "2026-03-28"
R-to-Python Translation Skill
R-to-Python translation reference for quantitative social science data analysis. Maps R ecosystem packages (tidyverse/dplyr, ggplot2, fixest, survey, sf, plm, lme4, marginaleffects, rdrobust) to DAAF Python equivalents (polars, plotnine, pyfixest, statsmodels, linearmodels, svy, geopandas). Use when user mentions R/RStudio background, requests R-equivalent code comments, needs to understand Python analysis code from an R perspective, or wants to translate R data analysis concepts to Python. Covers paradigm differences, verb-by-verb operation translations, regression modeling, causal inference, visualization, and workflow adaptation.
Cross-language translation reference for researchers moving between the R and Python data analysis ecosystems. This skill maps R packages, idioms, and workflows to their DAAF Python equivalents so that R-background users can audit, understand, and learn from DAAF-produced code, and so that code-producing agents can annotate their output with R equivalents when directed.
This skill is a **routing hub** — it provides overview tables, decision trees, and directs readers to the detailed reference files listed below. The reference files contain the exhaustive verb-by-verb mappings, code examples, and edge-case documentation.
What This Skill Does
- Maps the R data analysis ecosystem to DAAF's Python stack across data wrangling, modeling, visualization, causal inference, surveys, spatial analysis, and workflow tooling
- Provides a structured annotation protocol for agents to add inline R-equivalent comments to Python code
- Identifies paradigm gaps where R and Python diverge fundamentally, so users know where to expect friction
**Use cases:**
1. R user auditing DAAF Python code and needing to understand what operations are being performed 2. Agent annotating code with R-equivalent comments for an R-background researcher 3. R user learning Python for data analysis and needing a conceptual bridge 4. Translating a specific R operation or idiom to its Python equivalent 5. Understanding where R tools have no direct Python equivalent (and what the workaround is)
How to Use This Skill
Reference File Structure
Each topic in `./references/` contains focused documentation:
| File | Purpose | When to Read | |------|---------|--------------| | `paradigm-differences.md` | Core language and paradigm differences | Encountering fundamental R-vs-Python confusion | | `polars-dplyr.md` | Core dplyr/tidyr to polars verb mapping (select, filter, mutate, joins, reshaping, window functions, lazy eval) | Reading or writing data manipulation code | | `polars-strings-dates-factors.md` | String, date/time, and factor operations (stringr, lubridate, forcats to polars) | Working with string/date/categorical columns | | `regression-modeling.md` | fixest/stats/plm to pyfixest/statsmodels/linearmodels | Reading or writing regression code | | `visualization.md` | ggplot2/plotly R to plotnine/plotly Python | Reading or writing visualization code | | `causal-inference.md` | R causal inference ecosystem to Python equivalents | Working with DiD, RDD, IV, event studies | | `survey-spatial-ml.md` | survey/sf/tidymodels to svy/geopandas/scikit-learn | Working with surveys, spatial data, or ML | | `workflow-environment.md` | RStudio/Quarto workflow to DAAF/marimo workflow | Adapting to DAAF's execution model | | `external-resources.md` | Curated guides and tutorials with provenance | Seeking additional learning materials | | `gotchas.md` | Common R-user mistakes in Python | Debugging or reviewing code from R perspective |
Reading Order
1. **R user auditing DAAF code:** `paradigm-differences.md` then the relevant domain file (e.g., `polars-dplyr.md` for data wrangling, `regression-modeling.md` for models) then `gotchas.md` 2. **Agent annotating code with R equivalents:** Agent Code Annotation Protocol section below, then the relevant domain file for the code being annotated 3. **Learning Python from R background:** `paradigm-differences.md` then `polars-dplyr.md` then `workflow-environment.md` then `external-resources.md` 4. **Looking up a specific translation:** Quick Decision Trees below, then the relevant reference file
Quick Decision Trees
"How do I do X from R in Python?"
What kind of R operation?
├─ Data wrangling (filter, mutate, join, pivot, summarise)
│ └─ ./references/polars-dplyr.md
├─ Regression / statistical modeling
│ └─ ./references/regression-modeling.md
├─ Plotting / visualization
│ └─ ./references/visualization.md
├─ Causal inference (DiD, RDD, IV, event studies)
│ └─ ./references/causal-inference.md
├─ Surveys / spatial / machine learning
│ └─ ./references/survey-spatial-ml.md
└─ Fundamental language differences (types, syntax, environment)
└─ ./references/paradigm-differences.md"Why does this Python code look different from R?"
What looks unfamiliar?
├─ Expression syntax (pl.col().method().alias())
│ └─ ./references/paradigm-differences.md
├─ Missing values (None vs NaN vs null vs NA)
│ └─ ./references/paradigm-differences.md
├─ Formula interface (~) behaves differently
│ └─ ./references/regression-modeling.md
├─ Import patterns and namespacing
│ └─ ./references/gotchas.md
└─ No interactive REPL / console workflow
└─ ./references/workflow-environment.md"I want to translate an R script to Python"
What does the R script do? ├─ Loads and wrangles data (read_csv, dplyr verbs) │ └─ ./references/polars-dplyr.md ├─ Runs regressions (lm, feols, plm) │ └─ ./references/reg
📌 文档结构(2026-07-22 起): 本文件是中文默认入口 —— banner + badges + 信任面 + 9 阶段流水线速览 + 76 行合集总表。 每个合集的完整描述、按用途分组、精确数字、验证方法在 docs/CONTENT_ZH.md(扩展正文,总表行内的 → 直接跳转到对应锚点)。 English version: README-en.md · 中文扩展正文:docs/CONTENT_ZH.md · README-zh-CN.md 已弃用(重定向占位) 🌐 语言: English |
Other skills on auto-empirical-research-skills.
- /pipeline
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest + rdrobust + econml + causalml + matplotlib/seaborn. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) —
Open skill - /pipeline
Classical end-to-end empirical analysis workflow in the modern tidyverse + econometrics R ecosystem — dplyr + tidyr + haven + fixest + sandwich + lmtest + clubSandwich + AER + ivreg + did + bacondecomp + HonestDiD + eventstudyr + rdrobust + rddensity + Synth + gsynth + synthdid
Open skill - /pipeline
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid + did_imputation + eventstudyinteract + sdid + rdrobust + rddensity + synth + synth_runner + psmatch2 + teffects + ebalance + coefplot + esttab + asdoc +
Open skill - /00-Full-empirical-analysis-skill_StatsPAI
Use when the user asks to run a full empirical / causal analysis in Python — by default in the style of an applied economics paper (AER / QJE / JPE / ReStud / AEJ) with DID / RD / IV / SCM / DML / matching, written-out estimating equation + identifying assumption, Table 1 /
Open skill - /00.1-Full-empirical-analysis-skill_Python
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest + rdrobust + econml + causalml + matplotlib/seaborn. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) —
Open skill - /00.2-Full-empirical-analysis-skill_Stata
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid + did_imputation + eventstudyinteract + sdid + rdrobust + rddensity + synth + synth_runner + psmatch2 + teffects + ebalance + coefplot + esttab + asdoc +
Open skill

