rlang-patterns

Teach rlang metaprogramming patterns for tidy evaluation in R code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Functions that use tidy evaluation can be hard to reason about; this Skill provides a clear set of rlang metaprogramming patterns to write safer, more expressive R code.

Core Features & Use Cases

  • Data-masking concepts that let expressions refer to data frame columns as variables, including forward arguments using {{ }} and the .data pronoun.
  • Injection operators such as !! and !!! to programmatically build and splice expressions for dynamic code generation.
  • Dynamic dots patterns and helpers to manage tidy evaluation across data pipelines, with explicit use of .data and .env to avoid collisions.

Quick Start

Example: define a small function that uses {{ var }} to forward an argument into a dplyr call, and access a column with .data[[var]] for explicit safety.

Frequently Asked Questions about rlang-patterns

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

FAQPage Schema
How do I use rlang tidy evaluation to forward function arguments in R?

Tidy evaluation in rlang forwards function arguments using the {{ }} operator, allowing you to pass column names as variables directly into data-masking functions like dplyr verbs for dynamic pipeline execution.

What is data masking and how do .data and .env pronouns work in rlang?

Data masking lets expressions refer to data frame columns as variables. The rlang pronouns .data and .env explicitly resolve column names and environment variables, preventing naming collisions during tidy evaluation.

When should I use rlang injection operators like !! and !!! in R programming?

Use rlang injection operators !! and !!! when you need to programmatically build or splice expressions. These operators enable dynamic code generation by unquoting single values or splicing multiple arguments into a function call.

How do I manage dynamic dots in R package development with rlang?

Manage dynamic dots in rlang by using dedicated helpers to capture and process multiple arguments. This pattern ensures flexible tidy evaluation across data pipelines by cleanly handling variadic arguments passed through your functions.

Why does my custom R function fail to evaluate tidy evaluation arguments correctly?

Custom R functions fail tidy evaluation when arguments are not properly unquoted or forwarded. You must apply rlang patterns like {{ }} for data-masking or explicit .data pronouns to safely resolve variables within your function environment.