Tidy evaluation and programmatic tidyverse patterns using rlang. Use this skill when writing functions that accept column names as arguments, building tidyverse-compatible APIs, or working with data-masking and injection operators. Covers embracing with {{}}, injection (!! and !!!), dynamic dots, .data/.env pronouns, name injection with glue syntax, bridge patterns between selection and data-masking, and package development with rlang.
This skill covers modern rlang patterns for data-masking, tidy evaluation, and building programmatic tidyverse functions.
Data-masking allows R expressions to refer to data frame columns as if they were variables in the environment. rlang provides the metaprogramming framework that powers tidyverse data-masking.
{{}} - Forward function arguments to data-masking functions!! - Inject single expressions or values!!! - Inject multiple arguments from a list... with injection support.data/.env - Explicit disambiguation between data and environment variables| Operator | Use Case | Example |
|----------|----------|---------|
| {{ }} | Forward function arguments | summarise(mean = mean({{ var }})) |
| !! | Inject single expression/value | summarise(mean = mean(!!sym(var))) |
| !!! | Inject multiple arguments | group_by(!!!syms(vars)) |
| .data[[]] | Access columns by name | mean(.data[[var]]) |
{{}}Use {{}} to forward function arguments to data-masking functions. See embrace-examples.md.
...No special syntax needed for dots forwarding. See dots-forwarding.md.
.dataUse .data pronoun for programmatic column access. See data-pronoun-examples.md.
!!Create symbols from strings, inject values to avoid name collisions. See injection-examples.md.
!!!Inject multiple symbols from character vectors, splice lists of arguments. See splicing-examples.md.
list2() for Dynamic Dots SupportEnables splicing, name injection, and trailing commas. See dynamic-dots-examples.md.
Use glue syntax for dynamic column naming. See name-injection-examples.md.
.data and .env Best PracticesExplicit disambiguation prevents masking issues. See pronouns-examples.md.
Converting between data-masking and tidy selection behaviors:
across() as selection-to-data-mask bridgeacross(all_of()) as names-to-data-mask bridgeSee bridge-patterns.md.
Transform single arguments by wrapping, transform dots with across(). See transformation-patterns.md.
eval(parse(text = ...)) - Security riskget() in data mask - Name collision proneSee avoid-patterns.md.
{{ }} on non-arguments# In DESCRIPTION:
Imports: rlang
# In NAMESPACE, import specific functions:
importFrom(rlang, enquo, enquos, expr, !!!, :=)
#' @param var <[`data-masked`][dplyr::dplyr_data_masking]> Column to summarize
#' @param ... <[`dynamic-dots`][rlang::dyn-dots]> Additional grouping variables
#' @param cols <[`tidy-select`][dplyr::dplyr_tidy_select]> Columns to select
See testing-examples.md for testing data-masking and injection behavior.
source: Sarah Johnson's gist https://gist.github.com/sj-io/3828d64d0969f2a0f05297e59e6c15ad
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer