Skip to contents

This function computes the *midrange* for each column vector in the input matrix x. See the **Details** section below for further information.

Usage

colMidranges(x, rows = NULL, na.rm = T, ...)

Arguments

x

a numerical matrix features-by-samples

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

...

currently not used

Value

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

Details

The midrange score is the average of the lowest and highest values in a set of data. It is a measure of central tendency like the mean, median, and mode. However, it is more prone to bias than these other measures because it relies solely upon the two most extreme scores, which could potentially be outliers.

This function calculates the range of values in each column of x by calling colRanges. Then, it uses the min and max values to compute the score.

Author

Alessandro Barberis

Examples

x = matrix(data = c(1,2,2,1,1,3), ncol = 2)
colMidranges(x = x)
#> [1] 1.5 2.0