Equalize NP across components of a parsed record.
alignComponents.RdPads shorter OCIDs with trailing zeros (align = "max") or truncates
longer OCIDs (align = "min") so all components share the same NP.
Operates on a classified LONG table with columns t, OCID, s, and DIR.
Value
Named list with two elements:
DT: aligned LONGdata.tablewith the same columns as the input.NP: integer, final number of samples per component after alignment (the same for every OCID). When every OCID already shares the same NP the function returns without padding or truncation; the input is passed through asDTunchanged.
Examples
x <- data.table::rbindlist(list(
data.table::data.table(t = c(0, 0.01, 0.02), OCID = "H1",
DIR = "H1", s = c(1, 2, 3)),
data.table::data.table(t = c(0, 0.01), OCID = "H2",
DIR = "H2", s = c(1, 2)),
data.table::data.table(t = c(0, 0.01, 0.02), OCID = "UP",
DIR = "UP", s = c(0, 1, 0))
))
aligned <- alignComponents(x, align = "max")
aligned$NP
#> [1] 3