Skip to contents

TSL2TSW() casts a canonical long TSL table with t, s, ID, and OCID columns to wide TSW form with columns such as AT.H1, VT.H1, and DT.H1.

Usage

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

Arguments

.x

Canonical TSL data.table with columns t, s, ID, and OCID, plus optional metadata columns.

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 wide data.table keyed by <metadata>, t.

Examples

tsl <- data.table::data.table(RecordID = "R1", OCID = "H1",
                              ID = "AT", t = c(0, 0.01), s = c(1, 2))
TSL2TSW(tsl)
#> Key: <RecordID, t>
#>    RecordID     t AT.H1
#>      <char> <num> <num>
#> 1:       R1  0.00     1
#> 2:       R1  0.01     2