View source: R/weighted_stats.R
weighted_quantile | R Documentation |
Compute weighted quantiles
weighted_quantile(x, w, probs)
weighted_median(x, w)
x |
Observations |
w |
Case weights (optional) |
probs |
Quantiles to calculate |
A vector the same length as probs
with the corresponding weighted
quantiles of x
with weight w
. For integer weights, this is equivalent to
quantile(rep(x, w), probs)
The weighted median of x
with weights w
.
For integer weights, this is equivalent to median(rep(x, w))
Other weighted statistics:
weighted_moments()
,
weighted_tabulate()
weighted_median(1:6)
weighted_median(1:3, c(1, 4, 9))
weighted_median(1:3, c(9, 4, 1))
weighted_quantile(1:3, c(1, 4, 9), seq(0.0, 1.0, by = 0.25))
quantile(rep(1:3, c(1, 4, 9)), seq(0.0, 1.0, by = 0.25))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.