View source: R/weighted_quantile.R
weighted_quantile | R Documentation |
Computes a weighted quantiles of a vector or matrix. Based on the formula in Wikipedia (see the vignette) which is one of many ways to compute weighted quantiles.
weighted_quantile(x, w, probs = probs, na.rm)
x |
A numeric vector or matrix. For matrix, the quantiles are computed for each column. |
w |
A numeric vector of non-negative weights. Will be automatically normalised to sum to one. |
probs |
A numeric vector of probabilities with values between 0 and 1. |
na.rm |
If |
A weighted variance.
Compared to some other R functions, here the weights are regarded as probability weights, not frequency weights.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.