1

I was going through the documentation of rename() function in dplyr and found something interesting. They had this concept of unquoting of symbol, but I think I didn't quit grasp the idea from the example.

Unquoting: Like all dplyr verbs, select() supports unquoting of symbols:
library(dplyr)

vars <- c(var1 = "cyl", var2 ="am")
select(mtcars, !!vars)

And then they had a concept of !!!vars. tidyverse

Is it just selecting those two columns and that's it or something special going on. If not, why bother using it?

Slayer
  • 832
  • 1
  • 6
  • 21

1 Answers1

1

The select function supports strings, symbols as input arguments. When we have more variables, the !!! is used

select(mtcars, !!!vars)

The difference is that here it will also rename the column names to 'var1', 'var2' while in the other case it is stripping off the names

akrun
  • 874,273
  • 37
  • 540
  • 662