powered by
wtd.median computes the median of a numeric vector using weights.
wtd.median
wtd.median(x, weight = NULL, na.rm = TRUE)
A single numeric value representing the weighted median.
Numeric vector of values.
Optional numeric vector of weights.
Logical. If TRUE, removes missing values.
TRUE
Josh Pasek
wtd.quantile, median
wtd.quantile
median
x <- c(1, 2, 3, 4, 5) w <- c(1, 1, 5, 1, 1) wtd.median(x, weight = w)
Run the code above in your browser using DataLab