logic_ext | R Documentation |
All functions take logical or logical-like (i.e., 1, 0, or NA as integer or doubles) and return logical values.
Extensions to the base logical operations to account for NA
values.
base::isTRUE()
and base::isFALSE()
will only return single length TRUE
or FALSE
as it checks for valid lengths in the evaluation. When needing to
check over a vector for the presence of TRUE
or FALSE
and not being held
back by NA
values, is_true
and is_false
will always provide a TRUE
FALSE
when the vector is logical or return NA
is the vector x
is not
logical.
%or%
is just a wrapper for base::xor()
is_true(x)
## Default S3 method:
is_true(x)
## S3 method for class 'logical'
is_true(x)
is_false(x)
## Default S3 method:
is_false(x)
## S3 method for class 'logical'
is_false(x)
x %xor% y
OR(..., na.rm = FALSE)
AND(..., na.rm = FALSE)
either(x, y)
is_boolean(x)
none(..., na.rm = FALSE)
x , y |
A vector of logical values. If |
... |
Vectors or a list of logical values |
na.rm |
Logical, if |
Logical operations, extended
is_true()
, is_false()
, either()
, %or%
, AND()
, OR()
: A logical
vector, equal length of x
(or y
or of all ...
lengths)
is_boolean()
: TRUE
or FALSE
none()
: TRUE
, FALSE
, or NA
x <- c(TRUE, FALSE, NA)
y <- c(FALSE, FALSE, TRUE)
z <- c(TRUE, NA, TRUE)
isTRUE(x)
is_true(x)
isFALSE(x)
is_false(x)
x %xor% TRUE
TRUE %xor% TRUE
TRUE %xor% FALSE
NA %xor% FALSE
OR(x, y, z)
OR(x, y, z, na.rm = TRUE)
AND(x, y, z)
AND(x, y, z, na.rm = TRUE)
either(x, FALSE)
either(TRUE, FALSE)
either(FALSE, NA)
either(TRUE, NA)
none(x)
none(x & y, na.rm = TRUE)
is_boolean(x)
is_boolean(c(1L, NA_integer_, 0L))
is_boolean(c(1.01, 0, -1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.