are_lgl_ish() is a vectorized predicate function that checks
whether each element of its input can be safely coerced to a logical vector.
are_logical_ish() is a synonym of are_lgl_ish().
is_lgl_ish() is a scalar predicate function that checks if all elements of
its input can be safely coerced to a logical vector. is_logical_ish() is a
synonym of is_lgl_ish().
Usage
are_lgl_ish(x, ...)
is_lgl_ish(x, ...)
are_logical_ish(x, ...)
is_logical_ish(x, ...)
# Default S3 method
are_lgl_ish(x, ..., depth = 1)Value
are_lgl_ish() returns a logical vector with the same length as the
input. is_lgl_ish() returns a length-1 logical (TRUE or FALSE) for
the entire vector.
See also
Other logical functions:
specify_lgl(),
stabilize_lgl()
Other check functions:
are_chr_ish(),
are_dbl_ish(),
are_fct_ish(),
are_int_ish()
Examples
are_lgl_ish(c(TRUE, FALSE, NA))
#> [1] TRUE TRUE TRUE
is_lgl_ish(c(TRUE, FALSE, NA))
#> [1] TRUE
are_lgl_ish(c(1, 0, 1.0, NA))
#> [1] TRUE TRUE TRUE TRUE
is_lgl_ish(c(1, 0, 1.0, NA))
#> [1] TRUE
are_lgl_ish(c("T", "F", "TRUE", "FALSE", "true", "false", "1", "0"))
#> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
is_lgl_ish(c("T", "F", "TRUE", "FALSE", "true", "false", "1", "0"))
#> [1] TRUE
are_lgl_ish(c("T", "F", "a", "1.1"))
#> [1] TRUE TRUE FALSE TRUE
is_lgl_ish(c("T", "F", "a", "1.1"))
#> [1] FALSE
are_lgl_ish(factor(c("T", "a")))
#> [1] TRUE FALSE
is_lgl_ish(factor(c("T", "a")))
#> [1] FALSE
are_lgl_ish(list(TRUE, 0, "F", "a"))
#> [1] TRUE TRUE TRUE FALSE
is_lgl_ish(list(TRUE, 0, "F", "a"))
#> [1] FALSE