averageRows: Averages rows together

View source: R/util.R

averageRowsR Documentation

Averages rows together

Description

Rearranges and averages rows according to by.

Usage

averageRows(data, by = labels, func = mean, ...)

Arguments

data

the matrix whose rows should be averaged.

by

an integer or vector by which to average and/or rearrange rows.

func

the function to apply to the result. Default: mean.

...

additional arguments to be passed to aggregate().

Value

Returns a vector or matrix of averaged rows.

Author(s)

Rehrauer, Hubert

Schmid, Peter

Examples

m1 = matrix(1:20,5)
averageRows(m1,c(1,1,2,2,3))

uzh/ezRun documentation built on May 4, 2024, 3:23 p.m.