Column and row-wise medians of a matrix or median of a vector. | R Documentation |
Column and row-wise medians of a matrix or median of a vector.
colMedians(x,na.rm = FALSE, parallel = FALSE, cores = 0)
rowMedians(x,na.rm = FALSE, parallel = FALSE, cores = 0)
Median(x,na.rm=FALSE)
med(x,na.rm=FALSE)
x |
A vector, matrix or data.frame 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. |
cores |
Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores. |
The functions is written in C++ in order to be as fast as possible.
A vector with the column medians.
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
Median, colVars, colMeans (buit-in R function)
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.