Home › R › R tidyverse Copilot path instructions

R tidyverse Copilot path instructions

Path-specific Copilot instructions for R analysis code: tidyverse style, renv, native pipe, reproducible Quarto reports, and testthat.

GitHub CopilotR

How to use

Save this as .github/instructions/r.instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.github/instructions/r.instructions.mdDownload  
---
applyTo: "**/*.R,**/*.qmd,**/*.Rmd"
description: R and tidyverse conventions
---

# R (tidyverse)

- Dependencies are managed with `renv`: after adding a package run `renv::snapshot()` and commit `renv.lock`. Never call `install.packages()` inside scripts.
- Follow the tidyverse style guide: `snake_case`, `<-` for assignment, spaces around operators, lines under 80 chars. Format with `styler::style_file()`; lint with `lintr`.
- Use the native pipe `|>` in new code (R 4.1+), dplyr verbs (`filter`, `mutate`, `summarise(.by = )`), and tidyr for reshaping.
- Read data with `readr`/`arrow` and explicit `col_types`; write outputs to `output/` or `data/processed/`, never overwrite `data/raw/`.
- Paths with `here::here()`; no `setwd()` or absolute paths.
- No `library()` calls inside functions; use `pkg::fun()` there. Keep `library()` at the top of scripts.
- Functions over copy-paste: if code repeats three times, write a function with roxygen comments.
- Randomness: `set.seed()` once at the top of any script that samples or models.
- Plots with ggplot2: labelled axes with units, `theme_minimal()` or the project theme, colour-blind safe palettes (`viridis`).
- Reports in Quarto (`.qmd`) render from a clean session: `quarto render`.
- Packages: tests with `testthat` (`usethis::use_test()`), checks with `devtools::check()`.

More: all R rules · all GitHub Copilot rules

Related rules

Claude Agent SDK CLAUDE.md

CLAUDE.md for building agents with the Claude Agent SDK (Python/TypeScript): options, tools, permissions, and hooks.

Claude Code (CLAUDE.md)LLM apps & agents

CrewAI multi-agent AGENTS.md

AGENTS.md for CrewAI 1.x projects: YAML agents and tasks, crews and flows, tools, and cost-aware runs.

AGENTS.mdLLM apps & agents

dbt analytics engineering AGENTS.md

AGENTS.md for dbt projects (dbt Core / Fusion 1.9+): staging/marts layering, tests, docs, and selective runs.

AGENTS.mddbt

Google Agent Development Kit (ADK) AGENTS.md

AGENTS.md for Python agents built with Google ADK: agent and tool definitions, sub-agents, session state, adk web/run, and evaluation sets.

AGENTS.mdLLM apps & agents

LLM fine-tuning (TRL + PEFT) AGENTS.md

AGENTS.md for fine-tuning LLMs with Hugging Face TRL and PEFT (LoRA/QLoRA): data format, configs, evals, and safety.

AGENTS.mdHugging Face

Hugging Face Transformers CLAUDE.md

CLAUDE.md for Hugging Face Transformers and Datasets projects: model loading, devices, tokenization, inference, and safety.

Claude Code (CLAUDE.md)Hugging Face

Get the best new AI prompts every week

One short email a week: the best new prompts and rules for ChatGPT, Claude, Gemini, Midjourney, Cursor and more, plus what changed in the tools. Free, unsubscribe anytime.

Finishes on our newsletter page at beehiiv (opens in a new tab). Or subscribe directly.