Description Usage Arguments Details Value See Also Examples
weighted_median
computes a weighted median where the
exact location corresponds exactly to a cumulative weight of 0.5.
This yields a symmetric median.
1 | weighted_median(x, w, na.rm = FALSE)
|
x |
a numeric vector whose weighted sample median is wanted |
w |
a numeric vector of weights |
na.rm |
a logical value indicating whether |
Note that the weighted_median
function delivers a symmetric
median while the weighted_quantile
function with probability
0.5 delivers the lower median. Hence, the results of these two
functions will generally differ.
weighted sample median
1 2 | x <- c(0.1, 0.35, 0.05, 0.1, 0.15, 0.05, 0.2)
weighted_median(x, x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.