isTRUENA: Vectorized test for truth robust to NA

isTRUENAR Documentation

Vectorized test for truth robust to NA

Description

These functions work exactly the same as x == TRUE and x == FALSE but by default return FALSE for cases that are NA.

Usage

isTRUENA(x, ifNA = FALSE)

isFALSENA(x, ifNA = FALSE)

Arguments

x

Logical, or a condition that evaluates to logical, or a vector of logical values or conditions to evaluate.

ifNA

Logical, value to return if the result of evaluating x is NA. Note that this can be anything (i.e., TRUE, FALSE, a number, etc.).

Value

Logical or value specified in ifNA.

Functions

  • isFALSENA(): Vectorized test for truth robust to NA

See Also

isTRUE, isFALSE, TRUE, logical

Examples

x <- c(TRUE, TRUE, FALSE, NA)
x == TRUE
isTRUENA(x)
x == FALSE
isFALSENA(x)
isTRUENA(x, ifNA = Inf)
# note that isTRUE and isFALSE are not vectorized
isTRUE(x)
isFALSE(x)

omnibus documentation built on Sept. 17, 2024, 5:09 p.m.