hi @truecluster I noticed something inconsistent about the way NA_integer64_ is handled by is.na function of base R:
> is.na(list(NA_integer64_, NA_real_, NA_integer_))
[1] FALSE TRUE TRUE
I would have expected TRUE rather than FALSE above (same as below)
> sapply(list(NA_integer64_, NA_real_, NA_integer_), is.na)
[1] TRUE TRUE TRUE
The reason for this discrepancy is that base R is.na has a special method for lists which is hard coded in C: https://github.com/wch/r-source/blob/b560647e74459fa2f40262dcaf1abf171c197efc/src/main/coerce.c#L2247-L2271 (only for five types: logical/int, string, complex, real).
Do you think it would be possible to patch base R to fix this inconsistency? The fix would be to first check if there exists a method for is.na, and if so then use it (here the method is is.na.integer64) instead of the hard coded logic.
For reference I discovered this issue while fixing a bug in data.table::melt Rdatatable/data.table#5044 (comment)
hi @truecluster I noticed something inconsistent about the way
NA_integer64_is handled byis.nafunction of base R:I would have expected TRUE rather than FALSE above (same as below)
The reason for this discrepancy is that base R
is.nahas a special method for lists which is hard coded in C: https://github.com/wch/r-source/blob/b560647e74459fa2f40262dcaf1abf171c197efc/src/main/coerce.c#L2247-L2271 (only for five types: logical/int, string, complex, real).Do you think it would be possible to patch base R to fix this inconsistency? The fix would be to first check if there exists a method for
is.na, and if so then use it (here the method isis.na.integer64) instead of the hard coded logic.For reference I discovered this issue while fixing a bug in
data.table::meltRdatatable/data.table#5044 (comment)