cast
Changes the type of the selected columns to R for the next step of the reorder operation, so the column expression in by or byDesc can use functions of this type, for example, sum() for Int columns.
Nothing is converted: the columns and their values stay the same. The type has to fit the values of the selected columns.
See Grammar for more details.
For more information: See reorder on the documentation website.
Example:
val df = dataFrameOf("c", "d", "a", "b")(
3, 4, 1, 2,
1, 1, 1, 1,
)
// "b" has a smaller sum than "d", so they change places
df.reorder("d", "b").cast<Int>().by { sum() } // [c, b, a, d]Content copied to clipboard
Type Parameters
R
The new type of the selected columns.