Stop using !! and embrace {{ }}

Cpak
2 min readJul 21, 2020

dplyr is great for manipulating data.frames but it can be tricky combining it with custom functions. Let’s first create a small data example, called ex

library(dplyr)
ex <- mtcars %>% select(cyl, mpg, gear)
head(ex)
cyl mpg gear
Mazda RX4 6 21.0 4
Mazda RX4 Wag 6 21.0 4
Datsun 710 4 22.8 4
Hornet 4 Drive 6 21.4 3
Hornet Sportabout 8 18.7 3
Valiant 6 18.1 3

If you’ve tried using a custom function with dplyr you might have seen this error

--

--