krangl / krangl / gather

gather

fun DataFrame.gather(key: String, value: String, columns: List<String> = this.names, convert: Boolean = false): DataFrame

Gather takes multiple columns and collapses into key-value pairs, duplicating all other columns as needed. You use gather() when you notice that you have columns that are not variables.

Parameters

key - Name of the key column to create in output.

value - Name of the value column to create in output.

columns - The colums to gather. The same selectar syntax as for krangl::select is supported here

convert - If TRUE will automatically run convertType on the key column. This is useful if the column names are actually numeric, integer, or logical.

fun DataFrame.gather(key: String, value: String, columns: ColumnSelector, convert: Boolean = false): DataFrame