rlang-patterns

Combine data-masking and injection operators for tidy-eval R functions.

1|1|Updated May 5, 2026
One-click install
npx skills add https://github.com/cynkra/cynkra.ai.day --skill rlang-patterns-cynkra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rlang-patterns
Source: https://github.com/cynkra/cynkra.ai.day/tree/main/claude-code-r-skills/.claude/skills/rlang-patterns
Command: npx skills add https://github.com/cynkra/cynkra.ai.day --skill rlang-patterns-cynkra

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

rlang-patterns helps you write tidy-evaluation code that correctly handles data-masking, dynamic dots, and injection without ambiguity between data columns and environment variables.

Core Features & Use Cases

  • Data-masking argument forwarding with {{}} so function arguments behave like tidyverse expressions.
  • Expression and value injection using !! for single items and !!! for splicing multiple arguments (e.g., programmatic group_by, summarise inputs).
  • Dynamic dots and explicit disambiguation via list2(...) for flexible ... handling plus .data and .env to avoid name collisions in loops and reusable APIs.
  • Use case: Build an R helper that summarizes arbitrary columns selected at runtime, supports both column names and expressions, and generates predictable output column names.

Quick Start

Ask the AI to show how to implement an R function that takes a data frame and a user-provided column expression, then uses {{ }} and .data to compute a summary without name collisions.

Frequently Asked Questions about rlang-patterns

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

FAQPage Schema
How do I forward data-masking arguments in R functions that wrap dplyr?

Forward data-masking arguments in R functions that wrap dplyr by using the `{{ }}` operator. This ensures function arguments behave like native tidyverse expressions, correctly passing column names and expressions without ambiguity.

What is the difference between !! and !!! injection operators in tidy evaluation?

In tidy evaluation, the `!!` operator injects a single expression or value, while `!!!` splices multiple arguments from a list. Use `!!!` for programmatic `group_by` or `summarise` inputs when forwarding multiple dynamic arguments.

How do I prevent name collisions between data columns and environment variables in tidyverse functions?

Prevent name collisions between data columns and environment variables by using `.data` and `.env` pronouns. These explicitly disambiguate variables inside loops and reusable APIs, ensuring tidyverse functions resolve names from the correct scope.

Can I use dynamic dots to build flexible R functions that accept arbitrary arguments?

Yes, you can use dynamic dots to build flexible R functions by collecting `...` with `list2(...)`. This allows forwarding expressions via dynamic dots, enabling programmatic selection and splicing of arguments in dplyr and tidyr wrappers.

Why does my tidy-eval metaprogramming code fail when generating selections programmatically?

Tidy-eval metaprogramming code fails when generating selections programmatically if injection operators are misused. Apply `!!!` for splicing lists of columns and `{{ }}` for forwarding single arguments to satisfy tidy evaluation semantics and prevent ambiguity.

Do I need rlang to write custom dplyr wrappers that summarize arbitrary columns at runtime?

Yes, writing custom dplyr wrappers that summarize arbitrary columns at runtime requires rlang patterns. Combine `{{ }}` forwarding, `.data` pronouns, and `!!!` splicing to handle dynamic inputs and generate predictable output column names safely.