rolling_groups {PAutilities} | R Documentation |
Loop along a vector, returning n elements at a time in a list
Description
Loop along a vector, returning n elements at a time in a list
Usage
rolling_groups(values, n = 2L)
Arguments
values |
IntegerVector. The vector to loop along |
n |
int. The number of elements to return in each element of the resulting list |
Value
a list in which each element contains n
elements from
values
Note
For this function, the output elements contain raw values from
values
, whereas for get_indices
the output elements
contain the positions (i.e., indices) rather than the raw values
See Also
Examples
groups <- rolling_groups(0:50, 3)
head(groups)
tail(groups)
[Package PAutilities version 1.2.1 Index]