Number of group elements

computes the number of elements in each group of data in a table or timetable, and returns
a table containing the groups and their counts. A group is the set of unique combinations
of grouping variables in `G`

= groupcounts(`T`

,`groupvars`

)`groupvars`

. For example, ```
G =
groupcounts(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`

= groupcounts(___,`Name,Value`

)```
G =
groupcounts(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.`B`

= groupcounts(___,`Name,Value`

)

When making many calls to

`groupcounts`

, 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 variable using the command`categorical(Gender)`

.

`discretize`

| `findgroups`

| `groupfilter`

| `groupsummary`

| `grouptransform`

| `rowfun`

| `splitapply`

| `varfun`