colWeightedMads {DelayedMatrixStats} | R Documentation |
Computes a weighted MAD of a numeric vector.
colWeightedMads(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, constant = 1.4826, center = NULL, ...) rowWeightedMads(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, constant = 1.4826, center = NULL, ...) ## S4 method for signature 'DelayedMatrix' colWeightedMads(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, constant = 1.4826, center = NULL, force_block_processing = FALSE, ...) ## S4 method for signature 'DelayedMatrix' rowWeightedMads(x, w = NULL, rows = NULL, cols = NULL, na.rm = FALSE, constant = 1.4826, center = NULL, force_block_processing = FALSE, ...)
x |
A NxK DelayedMatrix. |
w |
a vector of weights the same length as |
rows |
A |
cols |
A |
na.rm |
a logical value indicating whether |
constant |
|
center |
Optional |
... |
Additional arguments passed to specific methods. |
force_block_processing |
|
Returns a numeric
scalar.
Missing values are dropped at the very beginning,
if argument na.rm
is TRUE
, otherwise not.
For the non-weighted MAD, see mad
. Internally
weightedMedian
() is used to calculate the weighted median.
# A DelayedMatrix with a 'matrix' seed dm_matrix <- DelayedArray(matrix(c(rep(1L, 5), as.integer((0:4) ^ 2), seq(-5L, -1L, 1L)), ncol = 3)) colWeightedMads(dm_matrix, w = 1:5) rowWeightedMads(dm_matrix, w = 3:1)