timetable

Methods

Method Reference: timetable.grouptransform

timetable: G = grouptransform (tt, groupvars, method)
timetable: G = grouptransform (tt, groupvars, method, datavars)
timetable: G = grouptransform (tt, groupvars, groupbins, method, …)
timetable: G = grouptransform (…, Name, Value)

Transform the variables of a timetable group by group.

G = grouptransform (tt, groupvars, method) groups the rows of tt by the variables named in groupvars and applies method to each data variable within each group. The result has the same rows as tt, in the same order and carrying the same row times, so a transform never moves a row in time.

groupvars names one or more variables, or the row dimension name, which groups by the row times themselves. method is one of 'zscore', 'norm', 'meancenter', 'rescale', 'meanfill' and 'linearfill', or a function handle applied to each group.

G = grouptransform (tt, groupvars, method, datavars) transforms only the variables named in datavars. By default every variable that is not a grouping variable is transformed.

G = grouptransform (tt, groupvars, groupbins, method, …) bins the grouping variables before grouping, groupbins being a bin count, a vector of edges, or a time unit for a datetime or duration variable.

A duration is binned by the units that have a fixed length of their own, 'second', 'minute', 'hour', 'day' and 'year'; a week, a month and a quarter have none and are refused. A narrow bin over a wide span asks for more bins than a categorical can name, and the call is refused rather than answered; MATLAB stops at 65536 bins there and returns a grid that does not reach the end of the span.

The following Name/Value pairs are accepted:

'ReplaceValues'
A logical scalar. When true (the default) each transformed variable replaces the one it came from; when false the results are appended as new variables named for the method and the variable they came from, as in zscore_Speed.
'IncludedEdge'
Which edge of a bin is included, 'left' (the default) or 'right'. It applies only where groupbins was given.

Source Code: timetable