Skip to contents

PSW2PSL() melts spectra columns named <ID>.<OCID> back to canonical long spectra rows. Derived RotD components such as D50 and D100 are returned as ordinary OCID values.

Usage

PSW2PSL(.x, by = "auto", ids = c("PSA", "PSV", "SD"))

Arguments

.x

Wide spectra table with a Tn column and spectra columns named <ID>.<OCID>.

by

Metadata columns to keep as row keys. The default "auto" uses all non-spectra columns except Tn.

ids

Preferred order for spectra IDs. Other IDs present in .x are kept after these values.

Value

A canonical long spectra data.table.

Examples

psw <- data.table::data.table(RecordID = "R1", Tn = 0.1, PSA.H1 = 1)
PSW2PSL(psw)
#>    RecordID   OCID    Tn     ID     S
#>      <char> <char> <num> <char> <num>
#> 1:       R1     H1   0.1    PSA     1