Apply function to table or timetable variables
applies
the function B
= varfun(func
,A
)func
separately to each variable
of the table or timetable A
and returns the results
in the table or timetable B
.
The function func
must take one input argument
and return arrays with the same number of rows each time it is called.
The i
th variable in the output argument, B{:,i}
,
is equal to func(A{:,i})
.
If A
is a timetable and func
aggregates
data over groups of rows, then varfun
assigns the
first row time from each group of rows in A
as
the corresponding row time in B
. To return B
as
a table without row times, specify 'OutputFormat'
as 'table'
.
applies
the function B
= varfun(func
,A
,Name,Value
)func
separately to each variable of
the table or timetable A
with additional options
specified by one or more Name,Value
pair arguments.
For example, you can specify which variables to pass to the function.
arrayfun
| cellfun
| convertvars
| findgroups
| groupsummary
| rowfun
| splitapply
| structfun
| vartype