From kevin.r.coombes at gmail.com  Tue Sep  7 19:03:51 2010
From: kevin.r.coombes at gmail.com (Kevin R. Coombes)
Date: Tue, 07 Sep 2010 12:03:51 -0500
Subject: [Rd] as.character on NaN gives "NaN", is that intentional?
In-Reply-To: <4C8666EE.9030807@bht-berlin.de>
References: <4C8666EE.9030807@bht-berlin.de>
Message-ID: <4C867077.5030607@gmail.com>

  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:
> Dear DevelopeRs,
>
> I am surprised about the outcome of the second command:
>
> str(as.character(as.numeric("ee"))) str(as.character(log(-1)))
>
> I would have expected a character NA. Is there an intention behind 
> this behavior?
>
> Best, Ulrike
>



[Rd] as.character on NaN gives "NaN", is that intentional?
Kevin R. Coombes