R editor setup
Use when setting up, doctoring, or repairing an R environment for Cursor or VS Code: install/check R, extensions, radian, httpgd, Air, languageserver, lintr, baseline research packages (tidyverse, renv, …), project air.toml / .vscode settings, or when the user says "/r-editor-setup" / "set up R". Does not teach statistics or map recipes (use ggplot-maps).From its SKILL.md
npx -y skills add dahliasan/researchskills --skill r-editor-setupAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
7.3 KB, as published. Nobody here has run it
/r-editor-setup — R environment for Cursor / VS Code
Get a machine ready for typical research R work: interpreter, editor IDE features, formatter, and a sensible package baseline. Doctor first; install only what is missing; verify with concrete checks.
Inspired by (and prefer linking to) official sources over ad-hoc memory:
- VS Code: R
- vscode-R wiki (macOS) (+ Windows/Linux siblings)
- vscode-R + renv
- Air editors / VS Code, CLI
usethis::use_air()- Community setup patterns: Datanovia R in VS Code
- Newer stack catalog: references/modern-tooling.md (Positron/Ark, btw/ellmer/mcptools, duckplyr, …)
Skill-ecosystem note: npx skills find has no strong R+VS Code env skill
(flutter/environment-setup patterns are the closest analogues; tiny R pattern
skills exist but are not install/doctor playbooks). This skill fills the
env-doctor gap. Quarto authoring stays upstream
(posit-dev/skills@quarto-authoring); this skill only installs/checks Quarto
CLI + quarto.quarto when needed — do not vendor or fork that skill here.
Modes
| Signal | Mode |
|---|---|
| "set up R / ready to code / install what I need" | full-setup |
| "is my R env OK? / doctor" | doctor |
| "install packages / tidyverse / missing pkgs" | packages |
| "Air / format on save / air.toml" | air-project |
| "format this file/folder" | format |
| "R MCP / btw / ellmer / connect agent to R" | ai-bridge |
| "Positron vs VS Code / Cursor" | ide-advice (point at modern-tooling; no forced migrate) |
Default: doctor → install gaps → packages (core + research baseline) → air-project if a project folder is open → re-doctor until green. Offer Tier D / Positron only when relevant.
Step 0 — Doctor (always)
Run the checks in references/doctor.md. Print a pass/fail table. Do not claim the environment is ready until:
Rscript -e 'R.version.string'works- Extensions
REditorSupport.randPosit.air-vscodeare installed (Cursor) - R packages
languageserverandhttpgdload - At least one verify check from doctor.md succeeds (terminal / plot / format)
Step 1 — Install missing system + editor pieces
Order matters (Datanovia, VS Code docs):
- R on PATH (CRAN; Windows: write version to registry)
- Extensions:
REditorSupport.r,Posit.air-vscode - Optional extensions:
RDebugger.r-debugger,quarto.quarto, Tombi - Air CLI (agents/CI) — see references/install.md
- radian (
pip/pipx) + pointr.rterm.*+r.bracketedPaste - Editor settings:
r.sessionWatcher,r.plot.useHttpgd
Details and OS notes: references/install.md.
Step 2 — Install / check R packages
Use the tiers in references/packages.md.
- Run the package doctor script (missing vs installed).
- Install Tier A (editor) without asking if the user asked for setup.
- Install Tier B (research baseline) unless the user asked for editor-only.
- Offer Tier C (domain: geo, mixed models, pipelines, duckplyr/mirai) — only what matches the open project or an explicit ask.
- Offer Tier D (ellmer / btw / mcptools) only for ai-bridge or an explicit ask; never silent-install API-key tooling.
- Prefer
pak::pak()whenpakis available; elseinstall.packages(). - On Windows, if compile fails, tell the user to install Rtools.
- If the user prefers Positron: follow modern-tooling.md (skip vscode-R; Air is bundled).
If the project uses renv, declare IDE deps in a scaffolding file per the
vscode-R renv wiki
(languageserver, httpgd, optional vscDebugger) so they enter the lockfile
/ cache — do not leave the language server broken inside renv.
Step 3 — Wire the project (Air + workspace)
Prefer workspace config (checked in) over user-global Air settings (Air VS Code guide).
In the project root:
- Prefer
usethis::use_air()whenusethisis available (createsair.toml,.vscode/settings.json,.vscode/extensions.json). - Else write templates from references/templates.md.
- Ask before
air formaton a whole tree (large diffs). - Optional CI:
usethis::use_github_action(url = "https://github.com/posit-dev/setup-air/blob/main/examples/format-check.yaml").
Step 4 — Verify (show, don't assume)
Walk the user (or run) the verify checklist in references/doctor.md:
R: Create R terminalworks (radian if configured)- Completions / hover work (
languageserver) plot(1:10)appears in the httpgd pane- Saving an
.Rfile formats with Air library(tidyverse)(or Tier B) loads
Air vs lintr vs Prettier
| Tool | Role |
|---|---|
| Air | Formatter (layout). Default width 80. Extension ships its own binary. |
| lintr | Linter via languageserver. Does not reformat. |
| Prettier | Not for .R. |
| styler | Legacy R formatter; prefer Air for new setups. |
Air usually does not wrap long # comments. Keep Air line-width and
lintr line_length_linter aligned when both are used.
Rules
- Doctor before installing; install only gaps; re-doctor after.
- Workspace Air settings +
air.tomlfor projects; avoid user-global format-on-save unless the user insists. - Scrub personal absolute paths from committed settings (use
${workspaceFolder}or omit machine-specificr.rtermfrom the repo — keep radian path in user settings). - Do not mass-format without confirmation.
- Route map code to
ggplot-maps; project scaffold toresearch-project-ops. - Cite upstream docs in the exit summary when something non-obvious was fixed.
- Quarto: install/check CLI + extension only. For
.qmdauthoring help, recommendnpx skills add posit-dev/skills@quarto-authoring -g. Never copy that skill into researchskills unless the user explicitly asks for an attributed in-house fork.
Exit
Report: mode, doctor table, packages installed, files written, verify results,
whether Reload Window is needed, and (if Quarto is in play) whether the
user should install the upstream quarto-authoring companion skill.