Rfast (version 1.7.3)

Column and row-wise medians: Column and row-wise medians

Description

Column and row-wise medians of a matrix

Usage

colMedians(x) rowMedians(x)

Arguments

x
A matrix with the data.

Value

A vector with the column medians.

Details

The functions is written in C++ in order to be as fast as possible.

See Also

med, colVars, colMeans (buit-in R function)

Examples

Run this code
x <- matrix( rnorm(100 * 1000), ncol = 1000 )
system.time( a <- apply(x, 2, median) )
system.time( b1 <- colMedians(x) )
all.equal(as.vector(a), b1)

Run the code above in your browser using DataCamp Workspace