assert_all: Assert all elements of a vector or list are 'TRUE'

View source: R/utils-sfmisc.R

assert_allR Documentation

Assert all elements of a vector or list are TRUE

Description

Check if all elements of x are TRUE, and throw an informative warning that contains the position and name (if any) of the element

Usage

assert_all(..., call = sys.call(-1))

Arguments

...

logical vectors or lists with only logical elements

Value

TRUE

See Also

assert()

Examples

try(
  assert_all(c("this is true" = TRUE, "this is FALSE" = FALSE, FALSE))
  assert_all(
    list(a = c(TRUE, FALSE), b = TRUE),
    list(TRUE)
  )
)

s-fleck/sfmisc documentation built on Nov. 21, 2023, 12:29 a.m.