reshape-long-to-wide
Description
reshape-long-to-wide
adaptor expands a key column and a value column from a datatable into a column for each key and filled in with previously paired values.
Inputs
data
Type: datatable
Required: Yes
The datatable in long format.
key column name
Type: text
Required: No
The name of the column to which keys are added. If unspecified, defaults to key
.
value column name
Type: text
Required: No
The name of the column to which values are added. If unspecified, defaults to value
.
Outputs
data
Type: datatable
A datatable in wide format.
Examples
Example 1: Default behaviour.
Inputs:
data:
id | code | country |
---|---|---|
1 | GB | United Kingdom |
2 | TR | Turkey |
3 | US | United States |
key column name:
code
value column name:
country
Outputs:
data
:
id | United Kingdom | Turkey | United States |
---|---|---|---|
1 | GB | ||
2 | TR | ||
3 | US |
-> Transformed all the columns in the datatable, from long to wide, using code
as key column name
and country
as the value column name.
Last updated