reject for filters

Remove the given columns or rows from the table. Opposite of `select`.

Signature

> reject {flags} ...rest

Flags

  • --ignore-errors, -i: ignore missing data (make all cell path members optional)

Parameters

  • ...rest: The names of columns to remove from the table.

Input/output types:

inputoutput
recordrecord
tabletable

Examples

Reject a column in the ls table

> ls | reject modified

Reject a column in a table

> [[a, b]; [1, 2]] | reject a
╭───┬───╮
 # │ b │
├───┼───┤
 0 2
╰───┴───╯

Reject a row in a table

> [[a, b]; [1, 2] [3, 4]] | reject 1
╭───┬───┬───╮
 # │ a │ b │
├───┼───┼───┤
 0 1 2
╰───┴───┴───╯

Reject the specified field in a record

> {a: 1, b: 2} | reject a
╭───┬───╮
 b 2
╰───┴───╯

Reject a nested field in a record

> {a: {b: 3, c: 5}} | reject a.b
╭───┬───────────╮
 ╭───┬───╮
 a c 5
 ╰───┴───╯
╰───┴───────────╯

Reject multiple rows

> [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb] [file.json json 3kb]] | reject 0 2

Reject multiple columns

> [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb]] | reject type size
╭───┬────────────╮
 # │    name    │
├───┼────────────┤
 0 Cargo.toml
 1 Cargo.lock
╰───┴────────────╯

Reject multiple columns by spreading a list

> let cols = [type size]; [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb]] | reject ...$cols
╭───┬────────────╮
 # │    name    │
├───┼────────────┤
 0 Cargo.toml
 1 Cargo.lock
╰───┴────────────╯

Notes

To remove a quantity of rows or columns, use skip, drop, or drop column.