From tlumley at u.washington.edu  Tue Apr  4 22:57:09 2006
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Tue, 4 Apr 2006 13:57:09 -0700 (PDT)
Subject: [Rd] is.numeric (NA + NA) is TRUE, should be FALSE (PR#8745)
In-Reply-To: <b0808fdc0604041252w5805cb49h19e4ecf40ff95427@mail.gmail.com>
References: <20060404193835.009E6AB7A@slim.kubism.ku.dk>
	<b0808fdc0604041252w5805cb49h19e4ecf40ff95427@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0604041352540.21419@homer23.u.washington.edu>

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



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