splitLong

fun splitLong(rows: List<Array<String>>, headers: List<String>, idColumn: String, valueColumn: String): List<NamedDataset>(source)

Splits a long-format table into one numeric series per distinct id.

rows are the data rows only (no header). headers names each column in row-position order and is used to resolve idColumn and valueColumn to indices.

Ids preserve first-encountered order. Each group is materialized to a DoubleArray in the order rows were supplied.

Throws ImportException when: a required column name is not found in headers, a row is shorter than the resolved column indices, a value-column cell does not parse as a double, or a resulting group is empty (cannot occur unless callers pre-filter).


Splits parallel id / value columns into one numeric series per distinct id, preserving first-encountered id order. Used by the database reader, which has already-typed columns rather than string rows.

ids and values must have the same length. Throws ImportException when they do not, or when a resulting group is empty.