Happy New Year everybody!

The name (is.nana) doesn't make much sense to me. Can you explain it?

One alternative would be to add an extra argument (e.g. 'strict') to 
is.na(). FALSE by default, and ignored (with or w/o a warning) when the 
type of 'x' is not "numeric".

H.


On 12/31/19 22:16, Jan Gorecki wrote:
> 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://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_a_26262984_2490497&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=oWT1wDiy7pogVlJHGtdOoM3zdB45t9zZVyGYU8qcOgo&s=zFj3lh-N_YlNBRlDKeO-aTs0Bf2qtWLUHKlw_nh2Q4o&e=
> 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
> 
> ______________________________________________
> R-devel@r-project.org mailing list
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=oWT1wDiy7pogVlJHGtdOoM3zdB45t9zZVyGYU8qcOgo&s=tCCxZtQj30QrtAYORMODT-OnjeKiXxiF0qlZtgyj1Mc&e=
> 

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to