Tidyeval with list of column names in a function
问题 I am trying to create a function that passes a list of column names to a dplyr function. I know how to do this if the list of columns names is given in the ... form, as explained in the tidyeval documentation: df <- tibble( g1 = c(1, 1, 2, 2, 2), g2 = c(1, 2, 1, 2, 1), a = sample(5), b = sample(5) ) my_summarise <- function(df, ...) { group_var <- quos(...) df %>% group_by(!!!group_var) %>% summarise(a = mean(a)) } my_summarise(df, g1, g2) But if I want to list the column names as an argument