krangl / krangl / spread

spread

fun DataFrame.spread(key: String, value: String, fill: Any? = null, convert: Boolean = false): DataFrame

Spread a key-value pair across multiple columns.

Parameters

key - The bare (unquoted) name of the column whose values will be used as column headings.

value - The bare (unquoted) name of the column whose values will populate the cells.

fill - If set, missing values will be replaced with this value.

convert - If set, attempt to do a type conversion will be run on all new columns. This is useful if the value column was a mix of variables that was coerced to a string.