-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Don't error when grouping zero-row data frames. Fixes #486 #487
Conversation
This seems reasonable (cc @romainfrancois), but did you check what happens when you try to filter, summarise etc a data frame with 0-length index? |
+1. Looks correct, but needs some dedicated test cases |
@wch could you please add a few test cases? |
Writing tests, but I'm not sure that all results are correct: dfg <- group_by(data.frame(a = numeric(0), g = character(0)), g)
group_size(dfg)
# integer(0) Should that be 0 instead of |
No, because |
So it shouldn't group on dfg
# Source: local data frame [0 x 2]
# Groups: g
groups(dfg)
# [[1]]
# g |
It looks like I misunderstood what |
I just added some more tests. @romainfrancois the call to
|
Thanks @wch; I'll pick it up. |
I only slightly modified two test cases. I think the rest was fixed as part of dealing with #486 |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
Fixes the error that previously occurred with:
I'm new to the C++ part of this codebase so please feel free to change, critique, etc.