all_true: Are all elements TRUE?

Description Usage Arguments Details Value Examples

View source: R/aux_funs.R

Description

Check whether all elements of a vector, matrix or array are TRUE.

Usage

1

Arguments

x

A vector, matrix or array.

Details

Note that numeric values are not coerced to logical. See examples.

Value

Boolean scalar. TRUE if every element of x is TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x <- array(TRUE, c(1, 2, 3))
all_true(x)

x[1, 2, 3] <- FALSE
all_true(x)

# Numeric is not coerced to logical
x[1, 2, 3] <- 1
all_true(x)

# A list might fail
y <- list(a = TRUE, b = matrix(TRUE, 3, 3), c = list(TRUE, TRUE))
all_true(y)

nielsaka/zeitreihe documentation built on March 17, 2020, 8:38 p.m.