timetable

Methods

Method Reference: timetable.rows2vars

timetable: tbl = rows2vars (tt)
timetable: tbl = rows2vars (tt, Name, Value)

Turn the rows of a timetable into variables.

tbl = rows2vars (tt) returns a table whose rows are the variables of tt and whose variables are its rows. The first variable, OriginalVariableNames, names the variables of tt; the rest are named for the row times they came from, rendered as the timetable displays them and made into valid names, and the second dimension of the result takes the name of the row dimension.

The result is a table and not a timetable: its rows are variables and there is no longer a time to label them by.

Where the variables are not all of one type the result holds cell arrays, every value being wrapped so that one variable can carry them all.

The following Name/Value pairs are accepted:

'DataVariables'
The variables of tt that become rows. By default all of them do.
'VariableNamesSource'
A variable of tt whose values name the new variables instead of the row times. A repeated name is numbered rather than refused, and the second dimension of the result takes the name of that variable.
'VariableNamingRule'
'modify' (the default) makes each new name a valid identifier; 'preserve' keeps it as it is.

Source Code: timetable