You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I use PostgreSQL to store my data, and will generally store numeric values with the 4-byte REAL type rather than the 8-byte FLOAT type because the extra precision is not needed and making smaller tables improves query performance.
However, this means that when I bring the data into R, equivalent values may differ at the 6th or 7th significant digit. As such, I'd love if I could setNumericRounding(4) so that the data.table package would treat values as equivalent if they match in the first four bytes only.
In case this is an easy fix, and you were just waiting for a use case like mine, please consider supporting higher values for setNumericRounding. I certainly like the idea behind the function, and only wish it could round a bit more.
Thanks!
Robert
The text was updated successfully, but these errors were encountered:
It does look simple enough to support this (#6083). If you have any minimal working example we could test, that would be great.
OTOH, it does seem like this is something to resolve with a package extension supporting more general data structures than available in base R. If the fix in #6083 has some flaws, I would rather close this as out-of-scope than pursue any really deep fix.
Therefore I doubt that setNumericRounding(4) is actually what you want. Given the complications uncovered in #6083, I would not pursue that PR further.
Glancing around, I find the {float} package supports single-precision numbers:
Hi,
I use PostgreSQL to store my data, and will generally store numeric values with the 4-byte REAL type rather than the 8-byte FLOAT type because the extra precision is not needed and making smaller tables improves query performance.
However, this means that when I bring the data into R, equivalent values may differ at the 6th or 7th significant digit. As such, I'd love if I could
setNumericRounding(4)
so that the data.table package would treat values as equivalent if they match in the first four bytes only.In case this is an easy fix, and you were just waiting for a use case like mine, please consider supporting higher values for setNumericRounding. I certainly like the idea behind the function, and only wish it could round a bit more.
Thanks!
Robert
The text was updated successfully, but these errors were encountered: