[Rd] New R function is.nana = is.na & !is.nan
Jan Gorecki
j@goreck| @end|ng |rom w|t@edu@p|
Wed Jan 1 07:16:31 CET 2020
Hello R-devel,
Best wishes in the new year. I am writing to kindly request new R
function so NA_real_ can be more easily detected.
Currently if one wants to test for NA_real_ (but not NaN) then extra
work has to be done: `is.na(x) & !is.nan(x)`
Required functionality is already at C level so to address my request
there is not that much to do.
Kevin Ushey made a nice summary of current R C api in:
https://stackoverflow.com/a/26262984/2490497
Pasting related part below, extra row added by me is a requested feature.
+---------------------+
| C fun | NaN | NA | R fun
+---------------------+
| ISNAN | t | t | is.na
| R_IsNaN | t | f | is.nan
| ISNA | f | t | is.na && !is.nan
| R_IsNA | f | t | is.na && !is.nan
+---------------------+
+---------------------+
| R fun | NaN | NA | C fun
+---------------------+
| is.na | t | t | ISNAN
| is.nan | t | f | R_IsNaN
+---------------------+
| is.nana | f | t | R_IsNA
+---------------------+
Strictly speaking, I am asking for a new R function:
is.nana <- function(x) if (typeof(x)=="numeric")
.Primitive("is.nana") else .Primitive("is.na")
Then probably a copy of C function `do_isnan` as `do_isnana` with a
minor change from `R_IsNaN` to `R_IsNA`.
Best,
Jan Gorecki
More information about the R-devel
mailing list