Drop-in replacements for any() and all() that default to na.rm = TRUE.
Arguments
- x
A logical vector.
- ...
Additional arguments passed to the base function.
- na.rm
Logical. Should missing values be removed? Default
TRUE.- all_na
Character. What to do when all values are NA:
"error"(default) throws an error,"base"returns what base R does withna.rm = TRUE(FALSEforany(),TRUEforall()),"na"returnsNA. IfNULL, usesgetOption("tidyna.all_na", "error").
Examples
x <- c(TRUE, NA, FALSE)
any(x)
#> Warning: ⚠️ 1 missing value removed.
#> [1] TRUE
all(x)
#> Warning: ⚠️ 1 missing value removed.
#> [1] FALSE