Skip to contents

This unexported helper function is used within plane_shape() to generate sliding windows from a vector and return a data frame where each row is a subset (a sliding window) of a time series. The length of the each windowed time series (and therefore number of columns) is equal to "window_size". The number of windows is equal to (length(vector) - window_size) + 1. For example, given a time series of length 38 and a window size of length 4, then there will be 35 windowed time series (rows), with 4 time stamps each (columns).

Usage

create_sliding_windows_df(vector, window_size)

Arguments

vector

A numeric or integer vector that is the time series to be used to create sliding windows

window_size

An integer specifying the size (i.e., number of elements) of the windowed time series desired

Value

A data.frame where each row is a subset (a sliding window) of a time series.