compact for filters

Creates a table with non-empty rows.

Signature

> compact ...rest

Parameters

  • ...rest: the columns to compact from the table

Examples

Filter out all records where 'Hello' is null (returns nothing)

> [["Hello" "World"]; [null 3]] | compact Hello
╭────────────╮
│ empty list │
╰────────────╯

Filter out all records where 'World' is null (Returns the table)

> [["Hello" "World"]; [null 3]] | compact World
╭───┬───────┬───────╮
│ # │ Hello │ World │
├───┼───────┼───────┤
│ 0 │       │     3 │
╰───┴───────┴───────╯

Filter out all instances of nothing from a list (Returns [1,2])

> [1, null, 2] | compact
╭───┬───╮
│ 01 │
│ 12 │
╰───┴───╯