-
Notifications
You must be signed in to change notification settings - Fork 985
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
Inaccurate sum of integer64 returned using by clause #1647
Comments
Yes confirmed. GForce needs to be |
Would it be possible to disable GForce if an integer64 column is detected until there is a proper fix? It is dangerous that |
This came up as a SO question at https://stackoverflow.com/questions/53051166/integer64-class-in-r-data-table-sum-and-by |
From the SO question (asked by myself), I will add some detail to this post. I also found the summing to be incorrect when negative integer64 class values are in the data.table, but I think it plays out differently than OP has described:
[this does not appear to be what is happening in OPs example] By playing around with the data.table, I found that With Example:
|
@moman822 Fyi, you see those results because gsum uses the core data (that you can see with
To avoid using gsum till this is supported, besides what akrun pointed out, you can wrap in parentheses:
|
That makes sense to me for when |
@moman822 The same idea applies:
We could take it to StackOverflow if it's still unclear (eg this chat room) since the package maintainers here on github seem to understand the problem already (from the second comment). |
Attached is a data.table with an integer64 column. Data.table returns the correct sum when the by clause is not used. However, when the by clause is used, the result is incorrect. The sum returned is interestingly the sum of the results except the final row.
Related scripts:
integer64_sum_with_group_example.zip
The text was updated successfully, but these errors were encountered: