8.2.54.32 table.rows2vars

Method: out = rows2vars (obj)
Method: out = rows2vars (obj, 'VariableNamesSource', VariableNamesSource)
Method: out = rows2vars (…, 'DataVariables', DataVariables)

Reorient table, swapping rows and variables dimensions.

This flips the dimensions of the given table obj, swapping the orientation of the contained data, and swapping the row names/labels and variable names.

The variable names become a new variable named “OriginalVariableNames”.

The row names are drawn from the column VariableNamesSource if it is specified. Otherwise, if obj has row names, they are used. Otherwise, new variable names in the form “VarN” are generated.

If all the variables in obj are of the same type, they are concatenated and then sliced to create the new variable values. Otherwise, they are converted to cells, and the new table has cell variable values.