relocate
Move columns to a new position, keeping their values and every other column.
NoteExperimental
This function is experimental; its interface may change without notice.
Since 0.6.0.
The positional columns move together, in the given order. By default they go to the front; before: / after: place them just before or after a target column instead. The two anchors are mutually exclusive.
Usage
relocate(
data,
..cols,
before: none,
after: none,
)Parameters
| Parameter | Default | Description |
|---|---|---|
data |
Row-store (array of dicts) or column-store (dict of arrays). | |
..cols |
Columns to move, as positional strings. | |
before |
none |
Target column to insert the moved columns before. |
after |
none |
Target column to insert the moved columns after. |
Returns
A row-store array with the columns reordered.
Examples
Bring class to the front.
#let front = relocate(mpg, "class")