Main Content

Group summary computations

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)`

.

`grouptransform`

| `groupfilter`

| `groupcounts`

| `findgroups`

| `splitapply`

| `discretize`

| `varfun`

| `rowfun`

| `convertvars`

| `vartype`