Do every or some elements of a list satisfy a predicate?

every(.x, .p, ...)

some(.x, .p, ...)

Arguments

.x

A list or atomic vector.

.p

A predicate function to apply on each element of .x. some() returns TRUE when .p is TRUE for at least one element. every() returns TRUE when .p is TRUE for all elements.

...

Additional arguments passed on to .p.

Value

A logical vector of length 1.

Examples

y <- list(0:10, 5.5) y %>% every(is.numeric)
#> [1] TRUE
y %>% every(is.integer)
#> [1] FALSE