roll: Generate rolling windows

Description Usage Arguments

View source: R/roll.R

Description

Generate resample objects of rolling windows over elements of a data frame.

Usage

1
2
roll(n, width = 1L, align = c("left", "right", "center"), partial = TRUE,
  indices = NULL, from = 1L, to = n, by = 1L, offsets = NULL)

Arguments

n

A positive, scalar integer representing the number of observations (items to choose from).

width

The window width.

align

Is the window left-aligned, right-aligned, or centered relative to the reference index of the window.

partial

A logical flag or numeric vector. If FALSE all indexes of a rolling window must be within the rows (or groups) of data. If TRUE, then the subset of indexes that are in range are used. A numeric argument to partial can be used to determine the minimal window size for partial windows.

indices, from, to, by

The indices at which to generate windows. If indices is non-NULL, then it is used. Otherwise, the indices are generated from seq(from, to, by).

offsets

An integer vector or NULL. If non-NULL, then it is the offsets of elements in the window relative to the reference index of the window; 0 is the reference index, negative numbers are indices before the index, while positive numbers are after the index. If NULL, the offsets are generated from the width and align arguments.


jrnold/ramsleep documentation built on May 29, 2019, 11:43 a.m.