head_while

0th

Percentile

Find head/tail that all satisfies a predicate.

Find head/tail that all satisfies a predicate.

Usage
head_while(.x, .p, ...)

tail_while(.x, .p, ...)

Arguments
.x

A list or atomic vector.

.p

A single predicate function, a formula describing such a predicate function, or a logical vector of the same length as .x. Alternatively, if the elements of .x are themselves lists of objects, a string indicating the name of a logical element in the inner lists. Only those elements where .p evaluates to TRUE will be modified.

...

Additional arguments passed on to .f.

Aliases
  • head_while
  • tail_while
Examples
# NOT RUN {
pos <- function(x) x >= 0
head_while(5:-5, pos)
tail_while(5:-5, negate(pos))

big <- function(x) x > 100
head_while(0:10, big)
tail_while(0:10, big)
# }
Documentation reproduced from package purrr, version 0.2.2.2, License: GPL-3 | file LICENSE

Community examples

Looks like there are no examples yet.