0

I have a vector of characters called splits in my markdown YAML and I want to pass all of those parameters to dplyr group_by function.

    ---
title: ""
params:
  splits: ['split1','split2','split3','split4','split5','split6']
---

data %>% group_by(params$splits)

where I get the error

 Problem adding computed columns in `group_by()`

I tried using vars() but it does not give me a dataframe with all the columns mentioned in splits which is what I want.

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
Pedro
  • 150
  • 10

1 Answers1

0

It was solved by the help of vars(one_of()) mentioned in:

Group by multiple columns in dplyr, using string vector input

Pedro
  • 150
  • 10