rlang-patterns

Explains how to use @, !!, and related tools for R metaprogramming and tidy evaluation.

Updated Mar 13, 2026
One-click install
npx skills add https://github.com/laurenoconnelllab/pTRAPPING --skill rlang-patterns-laurenoconnelllab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rlang-patterns
Source: https://github.com/laurenoconnelllab/pTRAPPING/tree/main/.claude/skills/rlang-patterns
Command: npx skills add https://github.com/laurenoconnelllab/pTRAPPING --skill rlang-patterns-laurenoconnelllab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive patterns and techniques for effective rlang metaprogramming and data-masking in R, simplifying complex programming tasks.

Core Features & Use Cases

  • Metaprogramming Patterns: Guides on using {{}}, !!, !!!, and .data pronouns for flexible, safe code writing.
  • Function Argument Forwarding: Techniques to pass arguments seamlessly with minimal boilerplate.
  • Advanced Injection: Methods to inject variables and expressions securely using !!, !!!, and name glueing.
  • Use Case: Develop robust, reusable data analysis functions that automatically handle variable programming using tidy evaluation techniques.

Quick Start

Use this pattern to write a function that groups a data frame by specified columns using tidy evaluation.

Frequently Asked Questions about rlang-patterns

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

FAQPage Schema
How do I use tidy evaluation to forward arguments in R functions?▼

Expression injection in R uses `!!` to inject single variables or expressions and `!!!` to splice lists of expressions. This Skill covers these advanced injection methods for secure, programmatic code writing.

What is the `.data` pronoun used for in rlang data-masking?▼

The `.data` pronoun in rlang explicitly references variables within the data frame during data-masking, preventing ambiguity with external variables. This Skill guides its proper usage for safe, robust data analysis functions.

How do I program dynamically with dynamic dots in rlang?▼

Dynamic dots in rlang allow flexible argument passing by enabling name glueing and expression splicing within your function calls. This Skill provides techniques for handling dynamic dots effectively in complex R package development.

Can I build flexible data analysis functions in R without deep metaprogramming knowledge?▼

You can build robust, reusable data analysis functions by applying specific rlang tidy evaluation patterns like `{{}}` and `!!!` rather than learning deep metaprogramming theory. This Skill supplies the exact coding techniques needed.

What are the limitations of using injection operators in tidy evaluation?▼

Tidy evaluation injection operators like `!!` and `!!!` must be used carefully to avoid unexpected scope issues or evaluation errors in programmatic R code. This Skill outlines best practices and precautions for safe metaprogramming.