r-style-guide

Enforce consistent R coding style with naming, spacing, and function design rules.

189|26|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/ab604/claude-code-r-skills --skill r-style-guide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r-style-guide
Source: https://github.com/ab604/claude-code-r-skills/tree/main/.claude/skills/r-style-guide
Command: npx skills add https://github.com/ab604/claude-code-r-skills --skill r-style-guide

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing consistent R code across projects can be challenging; this guide provides a formal standard for naming, spacing, layout, and function design to improve readability and maintainability.

Core Features & Use Cases

  • Enforces snake_case naming for variables and functions to promote readability and consistency across projects.
  • Recommends 2-space indentation, explicit line breaks, and tidy layout for easier review and collaboration.
  • Prescribes conventional assignment with <- and discourages ambiguous patterns to reduce errors.
  • Provides patterns for function design (single-responsibility functions, clear return values) to enhance reliability and testability.
  • Use Case: Teams working on R scripts or packages can apply these standards to ensure uniform style, simplify code reviews, and accelerate onboarding.

Quick Start

To start using the r-style-guide, adopt snake_case naming, prefer <- for assignment, maintain 2-space indentation, and structure code as outlined in the guide. Then apply the examples and standards when writing new scripts.

Frequently Asked Questions about r-style-guide

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the standard R coding conventions for naming and spacing?

Standard R coding conventions enforce snake_case naming for variables and functions, 2-space indentation, and explicit line breaks. This tidy layout improves readability and maintains consistent code structure across data analysis scripts and package development workflows.

How do I enforce a consistent R style guide across my team's scripts?

To enforce a consistent R style guide across your team, adopt snake_case naming, prefer the <- operator for assignment, and maintain 2-space indentation. Applying these formal standards to new scripts ensures uniform style and simplifies team code reviews.

Does this R style guide work with tidyverse packages and layouts?

Yes, this R style guide works with tidyverse packages by recommending tidy layout patterns, explicit line breaks, and 2-space indentation. These standards align with tidyverse conventions to promote readability and consistency in your data analyses.

What is the best way to structure R functions for readability and testability?

The best way to structure R functions is to follow single-responsibility patterns and define clear return values. This function design approach enhances reliability and testability while maintaining a clean, consistent codebase for software development.

Why should I use the assignment operator instead of equals in R scripts?

You should use the <- assignment operator in R scripts because it is the conventional standard that reduces ambiguous patterns. Using <- instead of equals ensures clear intent and maintains consistent code structure across your data analysis projects.