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
Clicking on the missing value in the first column will say "NA", whereas in the other columns it'll say "null". This is problematic because in order to differentiate true NA from the string "NA" we need to look at the column type. It would be better if "null" was always returned.
{reactable} v 0.3.0
The text was updated successfully, but these errors were encountered:
Thanks for the report. Previously I would've considered this an undocumented wart, but I agree that using null for numeric NAs would be so much better, especially since NA is represented as null for every other column type.
From vague memory, I think this was originally intentional because of jsonlite's handling of numerics with toJSON(na = "null"). If you use na = "null" to serialize NA as null, other non-NA numeric values get lost and converted to null for some reason:
Although there's no NaN or Inf in JSON, I still would've expected these to remain as strings and not converted to nulls.
So for a fix, the best path might be to leave the JSON serialization as-is but convert the NA/NaN/Inf strings to null/NaN/Inf on the JavaScript side, which would make NaN/Inf values easier to work with as well.
Since this will technically be a breaking change, a way to check for numeric NAs that would work both pre- and post-fix would be something like if (typeof value === 'number') { /* value is a number */ } else { /* value is NA */ }
Numeric NA values are now represented as null in JavaScript instead of an "NA" string.
Numeric NaN, Inf, and -Inf values are now represented as NaN, Infinity, and -Infinity
in JavaScript instead of "NaN", "Inf", and "-Inf" strings. (@daattali, #261)
See the example below:
Clicking on the missing value in the first column will say "NA", whereas in the other columns it'll say "null". This is problematic because in order to differentiate true NA from the string "NA" we need to look at the column type. It would be better if "null" was always returned.
{reactable} v 0.3.0
The text was updated successfully, but these errors were encountered: