Agentic R programming with Claude Code (or OpenCode) and RStudio.
This repo is an R project template. Clone it for each R project, and you get a ready-made environment where the assistant manages the RStudio connection via MCP. Your R scripts, data, and analysis all live in the same repo.
Supported clients: Claude Code and OpenCode (an open-source alternative to Claude Code).
You → Claude Code or OpenCode → MCP Server → RStudio
- macOS (Linux untested, Windows unsupported)
- Claude Code or OpenCode
In any terminal:
# Clone per project (each clone becomes its own R project workspace)
git clone https://github.com/naoto-iwase/Claude-R.git <your-project-name>
cd <your-project-name>
# Detach from the template repo so this becomes your own project
git remote remove originclaude
# Then ask: "Set up Claude-R" or /claude-ropencode
# Then ask: "Set up Claude-R" or /skills → claude-rIn the assistant, you type:
"Plot mpg vs hp from mtcars with a regression line"
The assistant generates and executes:
library(ggplot2)
ggplot(mtcars, aes(x = hp, y = mpg)) +
geom_point() +
geom_smooth(method = "lm")The plot appears in RStudio's Plots pane, and the assistant shows the result inline.
Other things you can ask:
"Run a t-test comparing groups A and B"
"Load data.csv and show summary statistics"
If something goes wrong, ask the assistant:
"Check Claude-R connection"
"Troubleshoot Claude-R setup"
- SKILL.md - Complete setup and usage guide
- Troubleshooting - Common issues and fixes
- Architecture - System design and data flow
MIT
Built on ClaudeR by IMNMV.
