GroupClose: Group together close adjacent elements of a vector.
Description
Given a strictly increasing vector (each element is bigger than the last),
group together stretches of the vector where adjacent elements are
separeted by at most some specified distance. Hence, each element in each
group has at least one other element in that group that is close to
it. See the examples.
Usage
GroupClose(vec.ascending, max.gap = 1)
Arguments
vec.ascending
A strictly increasing numeric vector.
max.gap
The biggest allowable gap between adjacent elements for them
to be considered part of the same group.
Value
A where each element is one group, as a numeric vector.