every: Do every, some, or none of the elements of a list satisfy a...

Description Usage Arguments Value Examples

View source: R/every-some-none.R

Description

Do every, some, or none of the elements of a list satisfy a predicate?

Usage

1
2
3
4
5
every(.x, .p, ...)

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

none(.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. none() returns TRUE when .p is FALSE for all elements.'

...

Additional arguments passed on to .p.

Value

A logical vector of length 1.

Examples

1
2
3
4
5
y <- list(0:10, 5.5)
y %>% every(is.numeric)
y %>% every(is.integer)
y %>% some(is.integer)
y %>% none(is.character)

Example output

[1] TRUE
[1] FALSE
[1] TRUE
[1] TRUE

purrr documentation built on April 19, 2020, 4:17 p.m.