Dplyr version of SQL `PARTITION BY` with sort order for use with SQL backend

I've not been working with dplyr for that long, so I didn't realize that the last group_by grouping just falls off after summarize! I just reproduced this a few different times and thought it was a bug, so did some googling and discovered:

hadley commented on Jan 1, 2015:

This is by design. After you've summarised, the last group will only have one row per group, so it's not useful to group on it.

Well now, I sure learned something today! Thank you very much @cderv and @edgararuiz!

I will be working this into my presentation to the NY R group next week!

2 Likes