wtd.median {weights} | R Documentation |
Weighted median
Description
wtd.median
computes the median of a numeric vector using weights.
Usage
wtd.median(x, weight = NULL, na.rm = TRUE)
Arguments
x |
Numeric vector of values. |
weight |
Optional numeric vector of weights. |
na.rm |
Logical. If |
Value
A single numeric value representing the weighted median.
Author(s)
Josh Pasek
See Also
Examples
x <- c(1, 2, 3, 4, 5)
w <- c(1, 1, 5, 1, 1)
wtd.median(x, weight = w)
[Package weights version 1.1.2 Index]