| rowMedians {matrixStats} | R Documentation |
Calculates the median for each row (column) in a matrix.
rowMedians(x, na.rm=FALSE, ...) colMedians(x, na.rm=FALSE, ...)
x |
A numeric NxK matrix. |
na.rm |
If TRUE, NAs are excluded first, otherwise not. |
... |
Not used. |
The implementation of rowMedians() is optimized for both
speed and memory.
To avoid coercing to doubles (and hence memory allocation), there
is a unique implementation for integer matrices, that is, if
x is an integer matrix, then rowMedians(as.double(x))
requires three times the memory compared with rowMedians(x).
Currently, colMedians(x) is calling rowMedians(t(x)).
Returns a numeric vector of length N (K).
Henrik Bengtsson (http://www.braju.com/R/)
See rowMeans() in colSums().