metaprogramming-rlang

Implement tidy evaluation and data-masking in R using rlang for programmatic tidyverse APIs.

2|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/justanesta/claude-code-resources --skill metaprogramming-rlang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: metaprogramming-rlang
Source: https://github.com/justanesta/claude-code-resources/tree/main/skills/R/metaprogramming-rlang
Command: npx skills add https://github.com/justanesta/claude-code-resources --skill metaprogramming-rlang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill enables developers to implement tidy evaluation and data-masking techniques in R using rlang, empowering reusable APIs that adapt to runtime column selections.

Core Features & Use Cases

  • embraces data-masking with {{}} to forward function arguments
  • demonstrates injection (!! and !!!), dynamic dots, and .data/.env pronouns for safe programmatic code
  • use case: wrap a generic summarise() or mutate() to operate on arbitrary columns without hard-coding names

Quick Start

Create a function that takes a data frame and a column name and returns a summary using programmatic tidy-eval patterns.

Frequently Asked Questions about metaprogramming-rlang

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

FAQPage Schema
How do I pass column names as arguments to a custom dplyr function without hard-coding them?

To pass column names as arguments in custom dplyr functions, use tidy evaluation to embrace them with {{ }}. This forwards function arguments safely into data-masking verbs like summarise() or mutate() without hard-coding names.

What is tidy evaluation and when do I need it for building programmatic tidyverse APIs?

Tidy evaluation is a framework in R that enables programmatic tidyverse APIs by bridging data-masking and selection patterns. You need it when building reusable functions that accept dynamic column names or inject expressions at runtime.

Why does my custom R function fail when I try to inject a list of columns into mutate?

Injection fails when lists are not properly spliced. To inject a list of columns into mutate, use the !!! operator for splicing, ensuring dynamic dots and expressions are safely evaluated within the data-masking environment.

What is the difference between .data and .env pronouns in rlang data-masking?

In rlang data-masking, the .data pronoun explicitly retrieves objects from the data frame, while .env retrieves objects from the execution environment. Using both ensures safe, name-stable, and robust programmatic code.

Can I use dynamic dots to wrap generic tidyverse functions for arbitrary column selections?

Yes, you can use dynamic dots to wrap generic tidyverse functions for arbitrary column selections. By passing ... and leveraging injection operators, your function can operate on any columns provided at runtime.

Are there limitations to using rlang tidy eval for data-masking in R?

Limitations of rlang tidy eval include a steep learning curve for syntax like embrace, injection, and pronouns. If functions lack proper .data or .env pronouns, code may become name-unstable or fail to resolve masking ambiguities safely.