Group by multiple columns in R's dplyr -


i group data frame multiple columns names elements of vector names_vec:

df %>% group_by(names_vec) 

i error message: "column names_vec unknown". because there no 1 column called names_vec.

how achieve this?

use rlang::syms() coupled !!!:

library(rlang) df %>% group_by(!!!syms(names_vec)) 

Comments

Popular posts from this blog

javascript - generate date range base on integers -

PHP and MySQL WP -