colMedians: Column and row-wise medians

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/median.R

Description

Column and row-wise medians of a matrix.

Usage

1
2

Arguments

x

A matrix with the data.

parallel

Do you want to do it in parallel in C++? TRUE or FALSE.

na.rm

TRUE or FAlSE for remove NAs if exists.

Details

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

Value

A vector with the column medians.

Author(s)

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

See Also

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

Examples

1
2
3
4
5
6
x <- matrix( rnorm(100 * 100), ncol = 100 )
a <- apply(x, 2, median) 
b1 <- colMedians(x) 
all.equal(as.vector(a), b1)

x<-a<-b1<-NULL

Example output

Loading required package: Rcpp
Loading required package: RcppZiggurat
[1] TRUE

Rfast documentation built on May 18, 2021, 1:07 a.m.