powered by
Loop along a vector, returning n elements at a time in a list
rolling_groups(values, n = 2L)
a list in which each element contains n elements from
n
values
IntegerVector. The vector to loop along
int. The number of elements to return in each element of the resulting list
get_indices
groups <- rolling_groups(0:50, 3) head(groups) tail(groups)
Run the code above in your browser using DataLab