collapsecols
Usage:
collapsecols [-[no]keepscalars] <array-colname> <col-id0> <ncol>
Adds a new array-valued column
by using the values from a specified range of scalar columns
as array elements.
The new column is named <array-colname>
,
and produced from the sequence of <ncol>
scalar columns starting with <col-id0>
.
The array type of the output column is determined by the type
of the first input column (<col-id0>
).
If it is of type Double
,
the output array column will be a double[]
array,
and similarly for types Long
, Integer
,
Float
and Boolean
.
Other integer types are currently mapped to int[]
,
and object types, e.g. String
,
to the corresponding array type.
Array elements for null or mistyped input values
are mapped to NaN for floating point types, but
note that they currently
just turn into zeros for integer array types
and false
for boolean.
By default the scalar columns that have been used are removed
from the output table and the new column replaces them
at the same position.
However, if you supply the -keepscalars
flag
they will be retained alongside the new array column
(the new column will appear just after the run of scalar
columns).
This filter does the opposite of
explodecols
.
Syntax for the <col-id0>
argument is described in Section 6.2.