powered by
wtd.quantile computes quantiles from a numeric vector using observation weights.
wtd.quantile
wtd.quantile(x, weight = NULL, probs = c(0.25, 0.5, 0.75), na.rm = TRUE)
A named numeric vector of quantiles.
Numeric vector of values.
Optional numeric vector of weights.
Numeric vector of quantile probabilities (between 0 and 1).
Logical. If TRUE, removes missing values.
TRUE
Josh Pasek
quantile, wtd.median
quantile
wtd.median
x <- c(1, 2, 3, 4, 5) w <- c(1, 1, 5, 1, 1) wtd.quantile(x, weight = w)
Run the code above in your browser using DataLab