-
Notifications
You must be signed in to change notification settings - Fork 993
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
Fix incorrect keying of by= results involving functions of keys #6708
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6708 +/- ##
=======================================
Coverage 98.62% 98.62%
=======================================
Files 79 79
Lines 14631 14642 +11
=======================================
+ Hits 14430 14441 +11
Misses 201 201 ☔ View full report in Codecov by Sentry. |
Generated via commit 3177ed1 Download link for the artifact containing the test results: ↓ atime-results.zip
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
i had no idea this was an issue.
there are so many special cases!
# For #5583, we also ensure there are no function calls in by (which might break sortedness) | ||
if (is.name(bysub)) return(TRUE) | ||
if (identical(bysub[[1L]], quote(list))) bysub = bysub[-1L] | ||
if (length(all.names(bysub)) > length(byvars)) return(FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice refactor and helper function name!
Closes #5583.
In principal this could be a breaking change for some user that has
by = .(a = foo(a))
wherea
is the key andfoo()
is weakly increasing.If we find any such case in revdeps, I will bump this change to 1.18.0 (there is a known workaround for the bug, i.e. use
keyby=
, and the bug appears to have taken quite some time to surface) and push the breaking change in next release. As a breaking change, the fix is also trivial (switch tokeyby=
).