R/statistics.R
weighted_median.Rd
Calculates weighted median based on weighted_quantile().
weighted_quantile()
weighted_median(x, w = NULL, ...)
Numeric vector.
Optional vector of non-negative case weights.
Further arguments passed to weighted_quantile().
A length-one numeric vector.
n <- 21 x <- seq_len(n) quantile(x, probs = 0.5) #> 50% #> 11 weighted_median(x, w = rep(1, n)) #> [1] 11 weighted_median(x, w = x) #> [1] 15 quantile(rep(x, x), probs = 0.5) #> 50% #> 15