Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Group summary computations

`G = groupsummary(T,groupvars)`

`G = groupsummary(T,groupvars,method)`

`G = groupsummary(T,groupvars,method,datavars)`

`G = groupsummary(T,groupvars,groupbins)`

`G = groupsummary(T,groupvars,groupbins,method)`

`G = groupsummary(T,groupvars,groupbins,method,datavars)`

`G = groupsummary(___,Name,Value)`

`B = groupsummary(A,groupvars,method)`

`B = groupsummary(A,groupvars,groupbins,method)`

`B = groupsummary(___,Name,Value)`

`[B,BG] = groupsummary(A,___)`

`[B,BG,BC] = groupsummary(A,___)`

returns a table containing the computed groups and the number of elements in
each group for data in a table or timetable `G`

= groupsummary(`T`

,`groupvars`

)`T`

. A group
contains the unique combinations of grouping variables in
`groupvars`

. For example, ```
G =
groupsummary(T,'Gender')
```

returns the number of
`Male`

elements and the number of `Female`

elements in the variable `Gender`

.

specifies additional grouping properties using one or more name-value pairs for
any of the previous syntaxes. For example, `G`

= groupsummary(___,`Name,Value`

)```
G =
groupsummary(T,'Category1','IncludeMissingGroups',false)
```

excludes
the group made from missing `categorical`

data indicated by
`<undefined>`

.

specifies additional grouping properties using one or more name-value pairs for
either of the previous array syntaxes.`B`

= groupsummary(___,`Name,Value`

)

When making many calls to

`groupsummary`

, consider converting grouping variables to type`categorical`

or`logical`

when possible for improved performance. For example, if you have a grouping variable of type`char`

(such as`Gender`

with elements`'Male'`

and`'Female'`

), you can convert it to a categorical value using the command`categorical(Gender)`

.

`discretize`

| `findgroups`

| `grouptransform`

| `rowfun`

| `splitapply`

| `varfun`