rlang-patterns

Write R tidy-eval functions using injection operators and data-masking patterns.

1|Updated May 13, 2026
One-click install
npx skills add https://github.com/impact-initiatives/ana_app --skill rlang-patterns-impact-initiatives
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rlang-patterns
Source: https://github.com/impact-initiatives/ana_app/tree/main/.claude/.claude/skills/rlang-patterns
Command: npx skills add https://github.com/impact-initiatives/ana_app --skill rlang-patterns-impact-initiatives

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

rlang-patterns helps you write correct and robust R functions that work with tidy evaluation, avoiding common pitfalls when mixing data-masking, non-standard evaluation, and programmatic column references.

Core Features & Use Cases

  • Data-masking argument forwarding with {{}}: build functions that accept column expressions naturally, like summarise(mean = mean({{ var }})).
  • Safe injection and splicing: use !! for injecting single expressions/values and !!! for injecting multiple arguments from lists (e.g., group_by(!!!syms(vars))).
  • Explicit pronoun disambiguation with .data / .env: reference columns and environment variables unambiguously in summarise/mutate and loops.
  • Dynamic dots patterns via list2(): capture ... flexibly, support splicing, and create injected names using "{name}" := value.
  • Bridges between tidy selection and data-masking: convert strings/vars into tidy-select or data-mask behavior using across(), all_of(), and symbol helpers.
  • Error-prone patterns to avoid: steer away from unsafe eval(parse(...)) and collision-prone get() approaches, favoring !!sym() and .data[[var]].

Quick Start

Use rlang metaprogramming patterns to create a tidy-eval friendly summarise function by injecting a column expression with {{}} and, when building from strings, injecting symbols with !!sym().

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 tidyverse functions?

Forward data-masking arguments in R tidyverse functions by using the `{{}}` injection operator to pass column expressions naturally to verbs like `summarise` or `mutate`, ensuring safe tidy evaluation.

What is the best way to reference columns by string in dplyr without eval(parse())?

Reference columns by string safely by using `.data[[var]]` for explicit pronoun disambiguation or `!!sym(var)` for symbol injection, avoiding unsafe `eval(parse())` and collision-prone `get()` approaches.

How do I splice a list of variables into tidyverse functions like group_by?

Splice a list of variables into tidyverse functions by converting strings to symbols with `syms()` and injecting them using the `!!!` operator, such as `group_by(!!!syms(vars))`.

When should I use dynamic dots with list2() in R metaprogramming?

Use dynamic dots with `list2()` in R metaprogramming when you need to capture `...` flexibly, support argument splicing, or create injected names dynamically using the `"{name}" := value` syntax.

How do I bridge tidy selection and data-masking in rlang?

Bridge tidy selection and data-masking in rlang by using `across()` and `all_of()` to convert strings or variable vectors into tidy-select behavior or data-masked expressions within mutate or summarise.

Why do my tidyverse functions suffer from name collisions in loops?

Name collisions in loops occur when column and environment variables conflict; fix this by using explicit `.data` and `.env` pronouns to disambiguate references within data-masking contexts.