[Rd] is.numeric (NA + NA) is TRUE, should be FALSE (PR#8745)
Thomas Lumley
tlumley at u.washington.edu
Tue Apr 4 22:57:09 CEST 2006
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 at u.washington.edu University of Washington, Seattle
More information about the R-devel
mailing list