Work with NA Values ​​in R

NA | TRUE #output :TRUE 
FALSE & NA #output :FALSE

Can anyone explain how R interprets these statements and gives a result.

+4
source share
1 answer

NA | TRUEreturns TRUEbecause of |, that is, an OR-operator that returns true when at least one condition is satisfied.

Similarly, it NA | FALSEwill return NAbecause it cannot be determined.

On the other hand, with the &AND operator , cases are reversed. In addition, it is mathematical logic and does not apply to the R-language.

+5
source

Source: https://habr.com/ru/post/1683220/


All Articles