Pivot
Converts information present in rows to columns
For example if the input table is as follow:
|Plate|Parameter|Dimension|
+-----+---------+---------+
| 1|height | 245|
| 1|width | 480|
| 2|height | 490|
| 2|width | 960|
If you select Pattern as Pivot columns and use ${Parameter} for Pattern and
set in the Other Columns tab Plate for Keys and Dimension for the Values, you will obtain the following result:
|Plate|height |width |
+-----+---------+---------+
| 1| 245| 480|
| 2| 490| 960|
If you change in the Other Columns tab, the Keys to Dimension and the Values to Plate, you will obtain the following table:
|Dimension|height |width |
+---------+---------+---------+
| 245| 1| ?|
| 280| ?| 1|
| 490| 2| ?|
| 960| ?| 2|
If you elect Plate as Pivot columns and choose in the Other Columns tab Parameter for Keys and Dimension for the Values (assuming the domain of Plate
was computed before, using the Domain Calculator KNIME node) setting the Pattern to ${Plate} will yield the following result:
|Parameter|1 |2 |
+---------+----+----+
|height | 245| ?|
|width | 490| ?|
|height | ?| 280|
|width | ?| 960|
Finally, you might want to pivot using the data in Parameter, rather than Plate. To do this, select Plate as Pivot columns,
and choose in the Other Columns tab Parameter for Keys and Dimension for the Values
after what you should change the Pattern to: "${}_on_plate_${Plate}". Doing this will result in the following table:
|Parameter|Dimension_on_plate_1|Dimension_on_plate_2|
+---------+--------------------+--------------------+
|height | 245| 280|
|width | 490| 960|
See also: sample workflow.
Dialog Options
- Pivot columns
- Values from these columns will become the parts of the columns in the result table (no columns with these names will be present). The domain of these columns should be available. Please use Domain Calculator node to achieve this.
- Pattern
- The format of the new columns.
${} - is replaced by the value contained in the columns selected as Values (in the Other Columns tab),
${pivot column name} value(s) of one of the nominal column used for pivoting (cf. columns selected in Pivot columns)).
- Behaviour
-
Handling of missing values in the result:
- fillEmpty - put empty cells.
- signalError - stop the conversion with an error.
What to do if there will be missing parts in the result:
- fillEmpty - put empty cells there
- signalError - stop the conversion with error.
- HiLite Strategy
- Support HiLite or not.
- Other Columns/Values
- The values of these columns will be added as part of the newly created columns names in place of ${}.
- Other Columns/Keys
- Data used for in the resulting cells.
Ports
- Input Ports
-
0 |
A table with known domains for the keys and pivoting columns. |
- Output Ports
-
0 |
Pivoted Table: The resulting transformed table. |
1 |
Reverse Pattern: A variable containing the pattern to use with the unpivot node. |