neighbours: Neighbouring integers

Description Usage Arguments Value See Also Examples

Description

Find integers within some radius of the given ones.

Usage

1
neighbours(k, x = 1:max(k), r = 0)

Arguments

k

integers within whose neighbourhood to look

x

allowed integers

r

radius within which to look

Value

Returns those integers in x which are at most r from some integer in k, i.e. the intersection of x with the union of the balls of radius r centred at the values of k. The return values are unique and sorted.

See Also

is.element, match, findInterval, stepcand

Examples

1
2
neighbours(c(10, 0, 5), r = 1)
neighbours(c(10, 0, 5), 0:15, r = 1)

Example output

Successfully loaded stepR package version 2.0-1.
Several new functions are added in version 2.0-0. Some older functions are deprecated (still working) and may be defunct in a later version. Please read the documentation for more details.
[1]  1  4  5  6  9 10
[1]  0  1  4  5  6  9 10 11

stepR documentation built on Aug. 26, 2020, 5:11 p.m.