groupsummary
Group summary computations
Syntax
Description
Table Data
G = groupsummary(T,groupvars)T. Groups are defined by
                    rows in the variables in groupvars that have the same unique
                    combination of values. Each row of the output table corresponds to one group.
                    For example, G = groupsummary(T,"HealthStatus") returns a
                    table with the count of each group in the variable
                        HealthStatus. 
You can use groupsummary functionality interactively by
                    adding the Compute by
                        Group task to a live script.
For more information, see Group Summary Computation.
G = groupsummary(T,groupvars,method)method and
                    appends the computation results to the output table as additional variables. For
                    example, G = groupsummary(T,"Location","median") returns the
                    median value of every nongrouping variable in T for each
                    location, in addition to the number of members in each location group.
G = groupsummary(___,Name,Value)G =
                        groupsummary(T,"Category1","IncludeMissingGroups",false) excludes
                    the group made from missing data of type categorical
                    indicated by <undefined> in
                    Category1.
Array Data
B = groupsummary(A,groupvars,method)method to unique groups in vector, matrix, or cell array
                        A. Groups are defined by rows in the column vectors in
                        groupvars that have the same unique combination of
                    values. Each row of the output array contains the computation results for one
                    group.
You can use groupsummary functionality interactively by
                    adding the Compute by
                        Group task to a live script.
B = groupsummary(___,Name,Value)
Examples
Input Arguments
Name-Value Arguments
Output Arguments
More About
Tips
- When making many calls to - groupsummary, consider converting grouping variables to type- categoricalor- logicalwhen possible for improved performance. For example, if you have a string array grouping variable (such as- HealthStatuswith elements- "Poor",- "Fair",- "Good", and- "Excellent"), you can convert it to a categorical variable using the command- categorical(HealthStatus).
- The - groupsummaryfunction computes one-dimensional summary statistics. To compute grouped summaries in two dimensions, consider using the- pivotfunction.
Alternative Functionality
Live Editor Task
You can use groupsummary functionality interactively by adding
                the Compute by
                    Group task to a live script.

Extended Capabilities
Version History
Introduced in R2018aSee Also
Functions
- pivot|- grouptransform|- groupfilter|- groupcounts|- summary|- findgroups|- splitapply|- discretize|- varfun|- rowfun|- convertvars|- vartype|- numunique