Weighted Quantiles
Compute weighted quantile
wtd.quantile (x, q=0.5, na.rm = FALSE, weight=NULL)
x
: Vector of data, same length as weight
q
: Quantile to computena.rm
: Logical: Should NAs be stripped before computation proceeds?weight
: Vector of weights. If NULL, the default, weights are not used.Uses a simple algorithm based on sorting.
Returns an empirical q quantile from a weighted sample.