all_neighbors: Test whether a binary predicate holds for all direct...

Description Usage Arguments Value Examples

Description

Test whether a binary predicate holds for all direct neighbors in a list

Usage

1

Arguments

f

Binary function used for comparing neighboring elements of ‘x’

...

One or more lists or vectors (holding elements of the same type)

Value

TRUE if all neighboring elements (even across lists) compare TRUE, otherwise FALSE.

Examples

1
2
3
4
5
6
7
8
9
all_neighbors(identical, c(1,1,1))
all_neighbors(identical, c(1,2,1))
all_neighbors(identical, c(NA,NA,NA))
all_neighbors(identical, c(1,NA,1))
all_neighbors(function(x,y) TRUE, 1:5)
all_neighbors(function(x,y) FALSE, c(1,1,1))
all_neighbors(function(x,y) y - x == 1L, 1:10)
all_neighbors(`<`, 1:10, 100:200)
all_neighbors(`<=`, list(a = 1, b = 3), list(c = 3, d = 5))

cbaumbach/miscFun documentation built on May 13, 2019, 1:48 p.m.