New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implicit arrange in group_by #1026
Comments
Sorting is expensive, so we can't do it automatically on large data. And in your case it would be faster to arrange after the summary. |
Oh, you're of course right about sorting after the summary. I wanted to suggest doing it automatically only if a summary leads to small data, not in every case. |
I think this somehow became the default now, which was rather unexpected to me. I'm not sure this is desired, because a NEWS entry for
and there seem to be no relevant news items that suggest the opposite in more recent versions. Test with CRAN version (0.4.3):
|
In some cases I think it would make sense if group_by %>% summarise automatically sorted by the grouping variables.
At the moment I write
Without the arrange dplyr keeps the data in some order, probably after the first occurrence of each level. I think this rarely is the desired behaviour. I'm not sure what the heuristic would be as to when an implicit arrange would be nice, but I'm pretty sure it always makes sense when you group by one variable and then summarise.
The text was updated successfully, but these errors were encountered: