Skip to contents

This function computes the *trimmed mean* for each column in an input matrix. See the **Details** section below for further information.

Usage

colTrimmedMeans(x, trim = 0, rows = NULL, na.rm = TRUE, ...)

Arguments

x

a numerical matrix features-by-samples

trim

the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint.

rows

(optional) numerical vector giving the rows in x or character vector matching the row names in x to operate over. If missing or rows = NULL, all the rows in x are considered for the computation of the measures

na.rm

logical, whether to remove NA values from x before computation

...

further arguments to trimmedMean

Value

A numerical vector containing the computed score for each column in x.

Details

This function applies trimmedMean to each column of the input matrix.

Author

Alessandro Barberis

Examples

x = matrix(data = sample(seq_len(10)), ncol = 2)
colTrimmedMeans(x = x, trim = 0)
#> [1] 4.8 6.2
colTrimmedMeans(x = x, trim = 0.2)
#> [1] 4.666667 6.666667