ts_projection: Time Series Projection

View source: R/ts_projection.R

ts_projectionR Documentation

Time Series Projection

Description

Split a ts_data (sliding windows) into input features and output targets for modeling.

Usage

ts_projection(ts)

Arguments

ts

Matrix or data.frame containing a ts_data representation.

Details

For a multi-column ts_data, returns all but the last column as inputs and the last column as the output. For a single-row matrix, returns ts_data-wrapped inputs/outputs preserving names and window size.

Value

A ts_projection object with two elements: ⁠$input⁠ and ⁠$output⁠.

Examples

# Setting up a ts_data and projecting (X, y)
# Load example dataset and create windows
data(tsd)
ts <- ts_data(tsd$y, 10)

io <- ts_projection(ts)

# Input data (features)
ts_head(io$input)

# Output data (target)
ts_head(io$output)

tspredit documentation built on Feb. 11, 2026, 9:08 a.m.