Re: [Rd] is.numeric (NA + NA) is TRUE, should be FALSE (PR#8745)

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Tue 04 Apr 2006 - 20:57:09 GMT

On Tue, 4 Apr 2006, Antonio, Fabio Di Narzo wrote:

> So in
> NA+NA
> the logical is automatically coerced to a numerical value, and
> is.numericreturns TRUE, as expected.
>
> But for some reason, all arithmetic operations on NA's are
>> in fact numeric, even if it's with other NA's.
>>

All arithmetic operatiosn on *logicals* are coerced to numeric, so if you have two logical NAs and add them you get a numeric NA.

This isn't anything special about NAs, since you would get the same conversion for TRUE+TRUE, and you would not get the same conversion for two character NAs

         -thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Apr 05 07:21:50 2006

This archive was generated by hypermail 2.1.8 : Wed 05 Apr 2006 - 00:16:56 GMT