tsibble (version 0.7.0)

stretch_tsibble: Perform stretching windows on a tsibble by row

Description

Perform stretching windows on a tsibble by row

Usage

stretch_tsibble(.x, .step = 1, .init = 1, .id = ".id")

Arguments

.x

A tsibble.

.step

A positive integer for incremental step.

.init

A positive integer for an initial window size.

.id

A character naming the new column .id containing the partition.

Rolling tsibble

slide_tsibble(), tile_tsibble(), and stretch_tsibble() provide fast and shorthand for rolling over a tsibble by observations. That said, if the supplied tsibble has time gaps, these rolling helpers will ignore those gaps and proceed.

They are useful for preparing the tsibble for time series cross validation. They all return a tsibble including new column .id as part of the key. The output dimension will increase considerably with slide_tsibble() and stretch_tsibble().

See Also

Other rolling tsibble: slide_tsibble, tile_tsibble

Examples

Run this code
# NOT RUN {
harvest <- tsibble(
  year = rep(2010:2012, 2),
  fruit = rep(c("kiwi", "cherry"), each = 3),
  kilo = sample(1:10, size = 6),
  key = id(fruit), index = year
)
harvest %>%
  stretch_tsibble()
# }

Run the code above in your browser using DataCamp Workspace