tsibble (version 0.7.0)

partial_slider: Partially splits the input to a list according to the rolling window size.

Description

Partially splits the input to a list according to the rolling window size.

Usage

partial_slider(.x, .size = 1, .step = 1, .fill = NA,
  .align = "right", .bind = FALSE)

partial_pslider(..., .size = 1, .step = 1, .fill = NA, .align = "right", .bind = FALSE)

Arguments

.x

An object to slide over.

.size

An integer for window size. If positive, moving forward from left to right; if negative, moving backward (from right to left).

.step

A positive integer for calculating at every specified step instead of every single step.

.fill

A value to fill at the left/center/right of the data range depending on .align (NA by default). NULL means no filling.

.align

Align index at the "right", "centre"/"center", or "left" of the window. If .size is even for center alignment, "centre-right" & "centre-left" is needed.

.bind

If .x is a list, should .x be combined before applying .f? If .x is a list of data frames, row binding is carried out.

...

Additional arguments passed on to the mapped function.

Examples

Run this code
# NOT RUN {
x <- c(1, NA_integer_, 3:5)
slider(x, .size = 3)
partial_slider(x, .size = 3)
# }

Run the code above in your browser using DataCamp Workspace