-
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
Operations involving group_by() can corrupt difftime values due to mixing up units. #2059
Comments
Yes, this why you shouldn't rely on difftime. See lubridate for alternatives. |
In my original use case, I was actually using
Is it possible to at least have dplyr emit a warning instead of silently returning erroneous results in this case? And thank you for all your wonderful packages - they make R so much more regular and enjoyable and help to avoid many gotchas! This issue, however, feels like a gotcha to me - particularly since I have not been able to find any warning about this in the dplyr or lubridate docs, and there is this comment of yours on SO:
|
Could hms be a useful option? This is basically difftime with seconds only, and nice formatting. We should do better in vctrs, this looks too specialized for dplyr. |
Now part of #2432 |
In this example, a result of "1 days" gets mis-reported as "1 secs", presumably because of a bug in handling units during re-combination of groupwise results:
The text was updated successfully, but these errors were encountered: