Skip to contents

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)
#>    RecordID   OCID     ID     t     s
#>      <char> <char> <char> <num> <num>
#> 1:       R1     H1     AT  0.00     1
#> 2:       R1     H1     AT  0.01     2