Install any skill in seconds. Free to start, no credit card required.
Get Started Free →brycewang-stanford/rlang-patterns
rlang metaprogramming patterns for data-masking, injection operators, and dynamic dots.
Passed 21 of 22 test cases with the skill, and 21 of 22 without it.
1 fixed20 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
A test case the skill fixed. Same model, same prompt, with and without the skill.
I am writing a helper function in R that wraps `dplyr::summarise()`. It should accept a data frame and a data-masked column expression to compute the mean, and produce an output column name automatically prefixed with 'mean_'. Please provide the function code following standard metaprogramming patterns that also allows users to optionally override the default output column name.
| Checked | Without skill | With skill |
|---|---|---|
| Uses englue in the default function argument to construct the default column name | Missed | Passed |
| Uses walrus operator name injection with string glue syntax for the column assignment | Missed | Passed |
The instructions your model reads when the skill loads.
Metaprogramming framework that powers tidyverse data-masking
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{{}}Use {{}} to forward function arguments to data-masking functions:
# Single argument forwarding
my_summarise <- function(data, var) {
data |> dplyr::summarise(mean = mean({{ var }}))
}
# Works with any data-masking expression
mtcars |> my_summarise(cyl)
mtcars |> my_summarise(cyl * am)
mtcars |> my_summarise(.data$cyl) # pronoun syntax supported
... (No Special Syntax Needed)# Simple dots forwarding
my_group_by <- function(.data, ...) {
.data |> dplyr::group_by(...)
test cases passed, vs 21 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.