grouptransform
Transform by group
Syntax
Description
transforms the data in a table or timetable using the computation in
G
= grouptransform(T
,groupvars
,method
)method
, grouping by the variables specified in
groupvars
. The output G
is a table or
timetable containing the transformed data in place of the nongrouping variables
from T
. For example, G =
grouptransform(T,'Gender','norm')
normalizes the data in
T
by gender using the 2-norm.
specifies additional grouping properties using one or more name-value arguments.
For example, G
= grouptransform(___,Name,Value
)G =
grouptransform(T,'Temp','linearfill','ReplaceValues',false)
appends the filled data as an additional variable of T
instead of replacing the nongrouping variables.
specifies additional grouping properties using one or more name-value arguments
for either of the previous array syntaxes.B
= grouptransform(___,Name,Value
)
Examples
Input Arguments
Output Arguments
Tips
When making many calls to
grouptransform
, consider converting grouping variables to typecategorical
orlogical
when possible for improved performance. For example, if you have a grouping variable of typechar
(such asGender
with elements'Male'
and'Female'
), you can convert it to a categorical value using the commandcategorical(Gender)
.
Extended Capabilities
Version History
Introduced in R2018bSee Also
groupsummary
| groupfilter
| groupcounts
| findgroups
| splitapply
| discretize
| varfun
| rowfun