0

This is simple question, I guess. when using group_by() from dplyr on several variables, can I use colon instead of comma to group variables?

Imagine I have V1 to V10 variables, and I want to group according to the first five. Do I need to:

group_by(V1, V2, V3, V4, V5)

Or can I:

group_by(V1:V5)

It seems I cannot, but is there any other alternative?

Thanks a lot.

Best,

David

Julian
  • 6,586
  • 2
  • 9
  • 33
David R
  • 77
  • 8
  • 2
    Have a look [here](https://stackoverflow.com/questions/67958155/group-byacrossall-ofvars-years-grouping-by-variables-with-a-fixed-year) – Julian Nov 21 '22 at 16:20
  • Thanks a lot Julian. `across()` did the trick for me. Best, David. – David R Nov 21 '22 at 16:38

0 Answers0