Calculates the median for each row (column) in a matrix.
A vector indicating subset of rows
(and/or columns) to operate over. If NULL, no subsetting
is done.
An integer vector of
length two specifying the dimension of x, also when not a
matrix.
Not used.
If TRUE (default), names
attributes of the result are set, otherwise not.
The implementation of rowMedians() and colMedians() is
optimized for both speed and memory. To avoid coercing to
doubles (and hence memory allocation), there is a
special implementation for integer matrices. That is,
if x is an integer matrix,
then rowMedians(as.double(x)) (rowMedians(as.double(x))) would
require three times the memory of rowMedians(x)
(colMedians(x)), but all this is avoided.
See rowWeightedMedians() and
colWeightedMedians() for weighted medians.
For mean estimates, see rowMeans2() and
rowMeans().