Perhaps I'm missing something obvious.
In R, TRUE && NA
evalues to NA
. This doesn't make sense to me, because &&
should evaluate left to right, and stop as soon as one of its conditions is true.
This doesn't make sense to me, because && should evaluate left to right, and stop as soon as one of its conditions is true.
This is wrong. You are mixing up &&
with ||
:
TRUE && FALSE
gives FALSE
&&
will short-circuit on FALSETRUE || FALSE
gives TRUE
||
requires a single condition to be TRUE||
will short-circuit on TRUEAlso,
TRUE || NA
gives
TRUE