weighted_quantile: Weighted quantile

View source: R/weighted_ntile_quanitle.R

weighted_quantileR Documentation

Weighted quantile

Description

quantile when the values are weighted

Usage

weighted_quantile(v, w = NULL, p = (0:4)/4, v_is_sorted = FALSE)

Arguments

v

A vector from which sample quantiles are desired.

w

Weights corresponding to each v.

p

Numeric vector of probabilities. Missing values or values outside [0, 1] raise an error.

v_is_sorted

(logical, default: FALSE) If TRUE, ordering v is assumed to be sorted. Only set to TRUE when it is certain that v is sorted (as within groups of tables).

Value

A vector the same length as p, the quantiles corresponding to each element of p.


ChandlerLutz/CLmisc documentation built on Dec. 2, 2022, 12:40 p.m.