Function to calculate weighted quantile. Extracted from package spatstat.geom v3.2-5
weighted.quantile(
x,
w,
probs = seq(0, 1, 0.25),
na.rm = TRUE,
type = 4,
collapse = TRUE
)
Data values. A vector pf numeric values, for which the median or quantiles are required.
Weights. A vector of nonnegative numbers, of the same lenght as x.
Probabilities for which the quantiles should be computed. A numeric vector of values between 0 and 1.
Logical. Whether to ignore NA values.
Integer specifying the rule for calculating the median or quantile, corresponding to the rules available for quantile. The only valid choices are type=1, 2 or 4.
Research use only.