Compute quantiles taking into account sample weights. The following methods are implemented:
quantileWt.default(x, weights=NULL, probs=seq(0, 1, 0.25), na.rm=TRUE, ...)
quantileWt.dataObj(x, vars, probs=seq(0, 1, 0.25), na.rm=TRUE, ...)
Additional parameters are:
weights an optional numeric vector containing sample weights.
vars a character vector of length 1 specifying a variable name that
is available in the dataslot of x
and which is used for the
calculation.
probs a numeric vector of probabilities with values in [0, 1].
na.rm a logical indicating whether any NA
or NaN
values
should be removed from x
before the quantiles are computed. Note
that the default is TRUE
, contrary to the function
quantile
.
1  quantileWt(x, ...)

x 
a numeric vector. 
... 
for the generic function 
If weights are not specified then quantile(x, probs, na.rm=na.rm,
names=FALSE, type=1)
is used for the computation.
Note probabilities outside [0, 1] cause an error.
A vector of the (weighted) sample quantiles.
Stefan Kraft and Bernhard Meindl
A basic version of this function was provided by Cedric Beguin and Beat Hulliger.
1 2 3 4 5 6  data(eusilcS)
(quantileWt(eusilcS$netIncome, weights=eusilcS$rb050))
# dataObjmethod
inp < specifyInput(data=eusilcS, hhid="db030", hhsize="hsize", strata="db040", weight="db090")
(quantileWt(inp, vars="netIncome"))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.