Skip to main content

Table.expand_to_rows

expand_to_rowscolumnat_least_one_row

Group: Calculations

Documentation

Expand aggregate values in a column to separate rows. For each value in the specified column, if it is an aggregate (Vector, Range, etc.), expand it to multiple rows, duplicating the values in the other columns.

The following aggregate values are supported: - Array - Vector - List - Range - Date_Range - Pair - Table - Column Any other values are treated as non-aggregate values, and their rows are kept unchanged. In in-memory tables, it is permitted to mix values of different types.

Arguments

  • column: The column to expand.
  • at_least_one_row: for an empty aggregate value, if at_least_one_row is true, a single row is output with Nothing for the aggregates column; if false, no row is output at all.

Examples

Expand a column of integer Vectors to a column of Integer

table = Table.new [["aaa", [1, 2]], ["bbb", [[30, 31], [40, 41]]]]

=> Table.new [["aaa", [1, 1, 2, 2]], ["bbb", [30, 31, 40, 41]]]