ts_data: ts_data

View source: R/ts_data.R

ts_dataR Documentation

ts_data

Description

Construct a time series data object used throughout the DAL Toolbox.

Accepts either a vector (raw time series) or a matrix/data.frame already organized in sliding windows. Internally, a ts_data is stored as a matrix with sw lag columns named ⁠t{lag}⁠ (e.g., ⁠t9, t8, ..., t0⁠). When sw is zero or one, the series is stored as a single column (t0).

Usage

ts_data(y, sw = 1)

Arguments

y

Numeric vector or matrix-like. Time series values or sliding windows.

sw

Integer. Sliding-window size (number of lag columns).

Value

A ts_data object (matrix with attributes and column names).

Examples

# Example: building sliding windows
data(tsd)
head(tsd)

# 1) Single-column ts_data (no windows)
data <- ts_data(tsd$y)
ts_head(data)

# 2) 10-lag sliding windows (t9 ... t0)
data10 <- ts_data(tsd$y, 10)
ts_head(data10)

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