timetable

Methods

Method Reference: timetable.groupsummary

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

Summarise the variables of a timetable group by group.

G = groupsummary (tt, groupvars) groups the rows of tt by the variables named in groupvars and returns a table with one row per group, carrying the grouping variables and a GroupCount variable. The result is a table and not a timetable: its rows describe groups rather than instants, so there is nothing left for row times to label.

groupvars names one or more variables, or the row dimension name, which groups by the row times themselves.

G = groupsummary (tt, groupvars, method) also applies method to each data variable of each group, adding one variable per method and data variable named for both, as in mean_Speed. method is one of 'mean', 'sum', 'min', 'max', 'range', 'median', 'mode', 'var', 'std', 'nummissing', 'nnz' and 'numunique', or 'all' for every one of them in that order, or a function handle, or a cell array of any of these. A name may be abbreviated to any unambiguous prefix. 'std' and 'var' are not defined on an integer variable and refuse one.

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

G = groupsummary (tt, groupvars, groupbins, …) 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.

The following Name/Value pairs are accepted:

'IncludeMissingGroups'
A logical scalar. When true (the default) rows whose grouping value is missing form a group of their own, sorted last.
'IncludeEmptyGroups'
A logical scalar. When true the unused categories of a categorical or binned grouping variable are reported as groups with a count of zero. It defaults to false.
'IncludedEdge'
Which edge of a bin is included, 'left' (the default) or 'right'. It applies only where groupbins was given.

Source Code: timetable