byName
Puts the columns selected by reorder in lexicographic order of their names and returns a new DataFrame.
It is a shortcut for by { it.name() }, or for byDesc { it.name() } when desc is true.
The selected columns change places only with each other: they take the positions of the selected columns, in the new order. Other columns stay where they are. The values in the columns do not change.
If the selected columns belong to different column groups, they are reordered within their groups, so no column moves to another group.
If exactly one column group is selected, its nested columns are reordered instead. A column group selected together with other columns moves as a whole, and its nested columns keep their order.
See Grammar for more details.
For more information: See reorder on the documentation website.
Examples:
// df: [name[firstName, lastName], age, city, weight, isHappy]
// Put the columns from "age" to "isHappy" in order of their names
df.reorder { age..isHappy }.byName() // [name, age, city, isHappy, weight]
// Put the nested columns of the "name" column group in descending order of their names
df.reorder { name }.byName(desc = true) // [name[lastName, firstName], age, city, weight, isHappy]Return
A new DataFrame with the selected columns reordered.
Parameters
If true, the columns are put in descending order. false by default.