Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 121

Note – Numeric equivalent and logical evalutation

Оглавление

Note that numbers different from zero are considered as TRUE, but only zero is considered as FALSE. Further, NA is implemented in a smartway. For example, in order to assess TRUE & NA we need to know what the second element is, hence it will yield NA. However, TRUE | NA will be true regardless what the second element is, hence R will show the result.

FALSE | NA ## [1] NA TRUE | NA ## [1] TRUE FALSE & NA ## [1] FALSE TRUE & NA ## [1] NA FALSE | NA | TRUE | TRUE ## [1] TRUE TRUE & NA & FALSE ## [1] FALSE

The Big R-Book

Подняться наверх