2

Why does R return 1 for NA^FALSE and NA for NA^TRUE? Was there a specific use case in mind when defining this behaviour?

Jakub.Novotny
  • 2,912
  • 2
  • 6
  • 21
  • 3
    From `?Arithmetic`: "Logical vectors will be coerced to integer or numeric vectors, `FALSE` having value zero and `TRUE` having value one." (and by default, `NA` is `logical`; `is.logical(NA)`). So, you will have `NA_real_^0` and `NA_real_^1`. From the same help text: "`y ^ 0` are 1, _always_". [Related reading on `NaN^0`](https://stackoverflow.com/questions/17863619/why-does-nan0-1), where also `NA^0` is discussed. – Henrik Mar 18 '21 at 12:07

0 Answers0