Lengthens data by increasing the number of rows (items) and decreasing the number of columns (keys) in a collection. The inverse transformation is pivotWider.
cols: The list of keys to pivot to the longer format. Takes the same style as in select::selectKeys
namesTo: Map the keys in the input to these output columns. If multiple values are provided via an array, the keys will be split per
valuesTo: Map the values in the input to these output columns. If multiple values are provided via an array, the keys will be split per
namesSepexpecting the name of the value output column as a prefix.
Widens data by increasing the number of columns (keys) and decreasing the number of rows (items) in a collection. The inverse transformation is pivotLonger.
namesFrom: Used in combination with
valuesFromto get the name of the output key and the value respectively. If
valuesFromcontains multiple values, the value key will be prefixed to the output keys, using
valuesFill: any values missing after widening will be filled with this value if specified. Ignored if
valuesFillMap: a map from pre-pivot keys to their default value when a value is not present in the widened item. See also replaceNully as a way to set defaults for keys after widening.