TSW2TSL: Convert wide time-series tables to canonical long form.

View source: R/tableContracts.R

TSW2TSLR Documentation

Convert wide time-series tables to canonical long form.

Description

TSW2TSL() melts wide time-series columns named ⁠<ID>.<OCID>⁠ back to canonical TSL rows.

Usage

TSW2TSL(.x, by = "auto", ids = c("AT", "VT", "DT"))

Arguments

.x

Wide TSW data.table with a t column, or a legacy constructor ts time column, plus signal columns named ⁠<ID>.<OCID>⁠.

by

Metadata columns to keep as row keys. The default "auto" uses all columns except t, s, ID, and OCID.

ids

Preferred order for signal IDs in the output columns. Other IDs present in .x are kept after these values.

Value

A canonical long data.table with metadata columns, OCID, ID, t, and s.

Examples

tsw <- data.table::data.table(RecordID = "R1", t = c(0, 0.01),
                              AT.H1 = c(1, 2))
TSW2TSL(tsw)

gmsp documentation built on July 18, 2026, 5:07 p.m.