0

I need to provide column names as a character for various tidyverse functions. I read here that this is possible with !!!sums(var_names) but it does not work out. Here is an example:

 df <- data.frame(a= 1:10, b= 1:10, c= 1:10)
 var <- "a"
 df %>% filter(!!!syms(var) < 5)

This gives me an error but I await the same output as for

 df %>%
   filter(a < 5)
  • Use `sym` : `df %>% filter(!!sym(var) < 5)` – Ronak Shah Jul 30 '20 at 14:36
  • Thank you, @RonakShah. There are so many options as can be seen in the linked post and in the link provided in my question. In my opinion there should be a more clear usage about character vectors for column names in tidyverse. –  Jul 30 '20 at 14:42

0 Answers0