NA | TRUE #output :TRUE
FALSE & NA #output :FALSE
Can anyone explain how R is interpreting these statements and giving output.
NA | TRUE #output :TRUE
FALSE & NA #output :FALSE
Can anyone explain how R is interpreting these statements and giving output.
NA | TRUE returns TRUE because of the | , i.e., the OR-operator which returns true when at least one condition is satisfied.
Likewise, NA | FALSE would return NA because it can not be determined.
On the other hand, with the & AND-operator, the cases are reversed. Also, this is mathematical logic and not specific to the R-language.