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:

input output
record record
table table

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 columns by a provided list of columns

> let cols = [size type];[[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb]] | reject $cols

Reject columns by a list of columns directly

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

Reject rows by a provided list of rows

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

Notes

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