Learn R Programming

Rrepest (version 1.5.2)

weighted.quant: Weighted quantile

Description

Computes weighted quantiles of a numeric vector.

Usage

weighted.quant(x, w = rep(1, length(x)), q = 0.5)

Value

Scalar containing the quantile

Arguments

x

(numeric vector) Variable of interest for which to compute the quantile

w

(numeric vector) Vector with the weights

q

(numeric vector) A number between 0 and less than 1 indicating the desired quantile

Examples

Run this code
weighted.quant(x = mtcars$mpg, w = mtcars$wt,  q = seq(.1,.9,.1))

Run the code above in your browser using DataLab