From 35a806d9edc56d5b308fdaf9a37df07473d21e83 Mon Sep 17 00:00:00 2001 From: mine-cetinkaya-rundel Date: Tue, 9 May 2023 22:57:02 -0400 Subject: [PATCH] Expand a bit on Boolean + missing, closes #1454 --- logicals.qmd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/logicals.qmd b/logicals.qmd index 3146e17..e778322 100644 --- a/logicals.qmd +++ b/logicals.qmd @@ -243,9 +243,11 @@ df |> ) ``` -To understand what's going on, think about `NA | TRUE`. +To understand what's going on, think about `NA | TRUE` (`NA` or `TRUE`). A missing value in a logical vector means that the value could either be `TRUE` or `FALSE`. -`TRUE | TRUE` and `FALSE | TRUE` are both `TRUE`, so `NA | TRUE` must also be `TRUE`. +`TRUE | TRUE` and `FALSE | TRUE` are both `TRUE` because at least one of them is `TRUE`. +`NA | TRUE` must also be `TRUE` because `NA` can either be `TRUE` or `FALSE`. +However, `NA | FALSE` is `NA` because we don't know if `NA` is `TRUE` or `FALSE`. Similar reasoning applies with `NA & FALSE`. ### Order of operations