Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

25.3.1 - Embracing for tidy evaluation showing up with one { instead of {{ #1685

Open
salleuska opened this issue Sep 24, 2024 · 0 comments
Open

Comments

@salleuska
Copy link

As the title says. I have checked on multiple browsers.

Here is a reference to the book part I am referring to. Not sure why this is happening!

r4ds/functions.qmd

Lines 400 to 405 in 9a9ec24

Tidy evaluation includes a solution to this problem called **embracing** 🤗.
Embracing a variable means to wrap it in braces so (e.g.) `var` becomes `{{ var }}`.
Embracing a variable tells dplyr to use the value stored inside the argument, not the argument as the literal variable name.
One way to remember what's happening is to think of `{{ }}` as looking down a tunnel --- `{{ var }}` will make a dplyr function look inside of `var` rather than looking for a variable called `var`.
So to make `grouped_mean()` work, we need to surround `group_var` and `mean_var` with `{{ }}`:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant