On Fri, May 19, 2017 at 6:38 AM, S Ellison <s.elli...@lgcgroup.com> wrote:
>> TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be
>> either TRUE or FALSE and consequently is NA.
>>
>> OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE.
>>
>> As I said *think* about it; don't just go with your immediate knee-jerk
>> (simplistic) reaction.
>
> Hmm... not sure that was quite fair to the OP. Yes,  FALSE & <anything> == 
> FALSE. But 'NA' does not mean 'anything'; it means 'missing' (see ?'NA'). It 
> is much less obvious that FALSE & <missing> should generate a non-missing 
> value. SQL, for example, generally  takes the view that any expression 
> involving 'missing' is 'missing'.

That's not TRUE ;)

sqlite> select (3 > 2) OR NULL;
1

sqlite> select (4 < 3) AND NULL;
0

Hadley


-- 
http://hadley.nz

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to