roll right

For filters.

Roll table columns right.

Command Type

built-in

Signature

> roll right {flags}

Flags

  • --by, -b {int}: Number of columns to roll.
  • --cells-only, -c: Rotates columns leaving headers fixed.

Input/output types:

input output
record record
table table

Examples

Rolls columns of a record to the right

> {a:1 b:2 c:3} | roll right
╭───┬───╮
│ c │ 3 │
│ a │ 1 │
│ b │ 2 │
╰───┴───╯

Rolls columns to the right

> [[a b c]; [1 2 3] [4 5 6]] | roll right
╭───┬───┬───┬───╮
│ # │ c │ a │ b │
├───┼───┼───┼───┤
│ 0 │ 3 │ 1 │ 2 │
│ 1 │ 6 │ 4 │ 5 │
╰───┴───┴───┴───╯

Rolls columns to the right with fixed headers

> [[a b c]; [1 2 3] [4 5 6]] | roll right --cells-only
╭───┬───┬───┬───╮
│ # │ a │ b │ c │
├───┼───┼───┼───┤
│ 0 │ 3 │ 1 │ 2 │
│ 1 │ 6 │ 4 │ 5 │
╰───┴───┴───┴───╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.