x
.wgt.himedian(x, weights = rep(1, n))
x
.median
; also wtd.quantile
from package x <- c(1:6, 20)
median(x) ## 4
stopifnot(all.equal(4, wgt.himedian(x)),
all.equal(6, wgt.himedian(x, c(rep(1,6), 5))))
Run the code above in your browser using DataLab