timetable

Methods

Method Reference: timetable.stack

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

Stack several variables of a timetable into one.

tt2 = stack (tt, vars) replaces the variables named in vars with a single variable holding their values one under the other, and an indicator variable naming which of them each value came from. Every other variable is carried along, repeated once per stacked variable, and so is the row time of the row it came from: a timetable of two rows stacking two variables has four rows and two pairs of equal row times, which generally makes it irregular.

vars names the variables to stack. A cell array of variable references stacks several groups at once, one new variable per group, each group holding the same number of variables.

[tt2, index] = stack (…) also returns index, naming the row of tt each row of tt2 came from.

The following Name/Value pairs are accepted:

'ConstantVariables'
The variables carried along unstacked. By default every variable that is not being stacked is carried.
'NewDataVariableName'
The name of the stacked variable, one per group. By default the names of the stacked variables are joined with underscores.
'IndexVariableName'
The name of the indicator variable. By default it is the name of the stacked variable followed by _Indicator.

See also: timetable

Source Code: timetable