Closed drizk1 closed 10 months ago
Awesome! To your question about grouping, I'd need to look and see how it works in dplyr/tidyr. My guess is that we need to "respect" grouping.
In other words, my guess is that if a grouped data frame is used, then we would ungroup it, apply the separate_rows transformation, and then regroup it. But I could be wrong.
We already do this for a handful of other macros I think, so it should be easy to implement if needed. Happy to help.
I would first check the behavior in R.
So i changed the function to now check if it is grouped, ungroup if it is, apply logic to ungrouped df, then regroup at the end. So now the macro can be used in a grouped chain / after a @group_by. thx for the tip!
I played around with a small df in R, and couldn't seem to elicit changes to the separating based on grouping or not, so I think this should be ok.
Thanks! I'll review and plan to merge soon.
I removed the macro component for grouped dataframes because I could not think of a scenario to group_by before separating rows that would change the outcome. I'm happy to add support to the function if that is useful.