Header_To_Row

Function Header_to_Row copies values from the table header to the first row.

Properties

Function has no additional properties.

Keywords

Header to Row, Copy Column Names to First Row, Excel Table, Table Names as Values

See Also

Row_To_Header, Flip_Horizontal, Flip_Vertical, Rename, Format

Video-tutorial

How to Insert Column Names to the First Table Row

Sometimes it may happen that you have stored as variable (column) names the values that should be used as values in the first table row. In this case, you can use the Header_To_Row function. The example is shown in the following figure.

The function allows you to select values from the table header and insert them to the first table row. However, this function works correctly only for some data types. For example, if the header contains a numeric value with decimal places, it will not be converted directly, because for column names are not supported special characters such as decimal separator (point or comma). The decimal separator is in header automatically converted to the underscore character ("_"). Consequently, you can not automatically get a correct value. Correct conversion can be in this case accomplished by using the combination of Str_Replace and Format functions.

As an example, we use the following table. The table header contains two integer values, one string and one boolean value.

To move these values from the header to the first table row we will use the Header_To_Row function from the Reshape ribbon toolbar tab.

Clicking this button will display the function in the sidebar. If you click on it, no customizable properties will appear in the properties panel.

To execute this function, press the Run button and the processing result appears in the table. The content of each header cell will be inserted into the first row of the table.

Then you can work with the dataset according to your needs. For example, you can modify the data type of each variable using the Format function and rename individual variables using the Rename function.

If you want to perform the opposite operation - to apply values from the selected row as variable names, you can use the Row_To_Header function.