colWeightedMedians {DelayedMatrixStats} | R Documentation |
Calculates the weighted medians for each row (column) in a matrix.
colWeightedMedians(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, ...) rowWeightedMedians(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, ...) ## S4 method for signature 'DelayedMatrix' colWeightedMedians(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, force_block_processing = FALSE, ...) ## S4 method for signature 'DelayedMatrix' rowWeightedMedians(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, force_block_processing = FALSE, ...)
x |
A NxK DelayedMatrix. |
w |
|
rows |
A |
cols |
A |
na.rm |
If |
... |
Additional arguments passed to specific methods. |
force_block_processing |
|
The implementations of these methods are optimized for both speed and
memory. If no weights are given, the corresponding
rowMedians
()/colMedians()
is used.
Returns a numeric
vector
of
length N (K).
Internally, weightedMedian
() is used.
See rowMedians
() and colMedians()
for non-weighted
medians.
# A DelayedMatrix with a 'SolidRleArraySeed' seed dm_Rle <- RleArray(Rle(c(rep(1L, 5), as.integer((0:4) ^ 2), seq(-5L, -1L, 1L))), dim = c(5, 3)) # Specifying weights inversely proportional to rowwise MADs colWeightedMedians(dm_Rle, w = 1 / rowMads(dm_Rle))