Logical operators (AND, OR) with NA, TRUE and FALSE

To quote from ?Logic:

NA is a valid logical object. Where a component of x or y is NA, the
result will be NA if the outcome is ambiguous. In other words NA &
TRUE evaluates to NA, but NA & FALSE evaluates to FALSE. See the
examples below.

The key there is the word “ambiguous”. NA represents something that is “unknown”. So NA & TRUE could be either true or false, but we don’t know. Whereas NA & FALSE will be false no matter what the missing value is.

Leave a Comment