Documentation for {{}}

My biggest takeaway from Hadley's talk Tidyverse: The Greatest Mistakes is the existence of the embrace {{ }} operator for doing tidyeval. It lets you do

my_summarise <- function(df, var, group){
  df %>%
    group_by({{group}}) %>%
    summarise(mean = mean({{var}}))

my_summarise(mtcars, mpg, cyl)

Instead of the usual enquo, !! cycle of doing things

My question is twofold:
a) where is the documentation for this operator? I can't seem to google or ctrl+f for this in the dplyr release notes
b) does the 'embrace' operator work with ...?. For example, is there a way to make this example work using {{ }}?

my_summarise <- function(df, var, ...){
  df %>%
    group_by({{...}}) %>%
    summarise(mean = mean({{var}}))

my_summarise(mtcars, mpg, cyl, gear)

Hi @nguyen,

You're right, we definitely need to centralize and clean up the documentation for rlang's embracing operator.

Some helpful resources in the meantime:
The rlang 0.4.0 release article section: A simpler interpolation pattern with {{

News from rlang 0.4.0.

The rlang quasiquotation docs
Specifically, the section below:

Since {{ is meant to deal with the simplest cases of quasiquotation/interpolation, I don't think you can pass the dots directly into the embracing operator, but don't 100% take my word on that. See, for example, how {{ and ... are used respectively in this document (note, however, that this some sections reflect experiments in and shouldn't be taken as set in stone):

See also the section on dealing with multiple arguments (including ...) in the in-progress tidyeval bookdown:


Update: You can follow the GitHub issue linked to below

1 Like

thanks Mara. I mostly wanted to share this with my coworkers, and it's good to at least have the release notes to point to

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.