timetable

Methods

Method Reference: timetable.unstack

timetable: tt2 = unstack (tt, vars, ivar)
timetable: tt2 = unstack (tt, vars, ivar, Name, Value)
timetable: [tt2, index] = unstack (…)

Spread one variable of a timetable across several.

tt2 = unstack (tt, vars, ivar) replaces the variable named in vars with one variable per distinct value of the indicator variable ivar, each holding the values that carried that indicator. Rows sharing a group become one row.

The row times group: with no 'GroupingVariables' given, one row comes back per distinct row time, so tt2 is a timetable carrying those times. A group that has no value for an indicator is filled with a missing value.

[tt2, index] = unstack (…) also returns index, naming a row of tt in each group.

The following Name/Value pairs are accepted:

'GroupingVariables'
The variables whose combinations define the rows of the result, alongside the row times.
'ConstantVariables'
The variables carried along unchanged, taken from one row of each group.
'NewDataVariableNames'
The names of the new variables, one per distinct indicator value.
'AggregationFunction'
The function applied where a group holds several values for one indicator. By default numeric data are summed and everything else must be unique within its group.
'VariableNamingRule'
'modify' (the default) makes each new name a valid identifier; 'preserve' keeps it as it is.

See also: stack, timetable

Source Code: timetable