<< get_dummies CHE3007S heatmap >>

CHE3007S >> CHE3007S > group_by

group_by

A function to perform a group by operation. This function groups data according to the unique values in the target column of the data, splits the data according to those groups and applies a function to the split data.

Syntax

[outputs] = group_by(header, data, sheader, sdata, target_column, fun_name)

Parameters

header:

m x 1 vector of headers for numeric data

data:

n x m matrix of numeric data, with matrix of column vectors

sheader:

p x 1 matrix of corresponding headers for string/text data

sdata:

n x p matrix of string/text data with data as column vectors

target_column:

Column on which to group the data and calculate the relevant statistics

fun_name:

function by which to aggregate the data, the options are "mean", "sum", "min", "max", "stdev" and "count"

output:

structure containing grouped data for each matrix column, and the corresponding headers and unique groups.

Description

If the data is provided in an n x m matrix, and the group volumn has p unique groups. The output of this function contains the result of applying the desired function to the split groups. A structure with the following fields is returned:


Report an issue
<< get_dummies CHE3007S heatmap >>