[R] [FORGED] Logical Operators' inconsistent Behavior

Duncan Murdoch murdoch.duncan at gmail.com
Fri May 19 15:02:00 CEST 2017


On 19/05/2017 8:48 AM, S Ellison wrote:
>>> SQL, for example, generally takes the view that any
>>> expression involving 'missing' is 'missing'.
>>
>> Well, then SQL gets it wrong.
>
> Well, that's a view. But paraphrasing an  R Turner from a few lines away in the same email:
>
>> One should be very, very circumspect about presuming to know better than
>> SQL
>
> It's a choice. I understand and respect R's. But I can also understand why someone might have expected something different.

You're right about SQL.  But for R, it's pretty simple to read the help 
page on NA, and it is quite explicit about this:

"Logical computations treat NA as a missing TRUE/FALSE value, and so may 
return TRUE or FALSE if the expression does not depend on the NA operand."

I'm surprised nobody on this thread has quoted that before.

Duncan Murdoch



More information about the R-help mailing list