Skip to content
Prev 37643 / 63421 Next

as.character on NaN gives "NaN", is that intentional?

It seems to me that preserving information about the kind of number 
(or not) present would be useful. I rather like the fact that
    as.numeric(as.character(NaN))
and
    as.numeric(as.character(Inf))
both work as the identity operator on numeric-like objects.  (In this 
context, note that both is.numeric(NaN) and is.numeric(Inf) both return 
TRUE.)  In your example, the character string "ee" does not represent 
any number that I know about (at least in standard R).

     Kevin
On 9/7/2010 11:23 AM, Ulrike Gr?mping wrote: