is_true {fritools} | R Documentation |
Convert a logical
Array to a Binary Boolean Array
Description
I often use mathematical expressions to index data by its values. But when the data contain missing values, the logical indices do not index the data, so I need to convert them to boolean.
Usage
is_true(x)
Arguments
x |
An |
Value
A binary boolean array indicating where the logical
array is TRUE
.
See Also
Other logical helpers:
get_run_r_tests()
,
is_batch()
,
is_cran()
,
is_false()
,
is_force()
,
is_installed()
,
is_not_false()
,
is_null_or_true()
,
is_of_length_zero()
,
is_r_cmd_check()
,
is_r_package_installed()
,
is_running_on_fvafrcu_machines()
,
is_running_on_gitlab_com()
,
is_scalar()
,
is_scalar_convertible2numeric()
,
is_success()
,
is_version_sufficient()
,
is_windows()
Examples
x <- array(1:24, dim = c(2,3,4))
x[2,2,3] <- NA
print(x)
x < 20 # An array containing NA
is_true(x < 20) # An array boolean only, NA converted to FALSE
print(x <- x[2, TRUE, TRUE])
is_true(x < 20) # A matrix
x <- x[2, TRUE]
is_true(x < 20) # A vector
x <- x[3]
is_true(x < 20) # A scalar
[Package fritools version 4.5.0 Index]