| weightedMedian | R Documentation |
Computes the weighted median of a numeric vector.
weightedMedian(x, w)
x |
Numeric vector. |
w |
Integer vector of weights. |
Here, the median of an even length n of x is defined as x_{(n/2 + 1)} if x_{(i)} is the i-th largest element in x, i.e. the larger value is taken.
Weighted median of x with respect to w.
x <- c(1, 4, 9)
w <- c(5, 1, 1)
weightedMedian(x, w)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.