Learn R Programming

PAutilities (version 1.1.0)

rolling_groups: 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)

Value

a list in which each element contains n elements from

values

Arguments

values

IntegerVector. The vector to loop along

n

int. The number of elements to return in each element of the resulting list

See Also

get_indices

Examples

Run this code
groups <- rolling_groups(0:50, 3)
head(groups)
tail(groups)

Run the code above in your browser using DataLab