wquantile | R Documentation |
Calculates empirical sample quantiles with optional weights, for given
probabilities. Like in quantile()
, the smallest observation corresponds to
a probability of 0 and the largest to a probability of 1.
Interpolation between discrete values is done when type=7
, as in quantile()
.
Use type=1
to only generate quantile values from the raw input samples.
wquantile(
x,
probs = seq(0, 1, 0.25),
na.rm = FALSE,
type = 7,
weights = NULL,
...
)
x |
numeric vector whose sample quantiles are wanted.
|
probs |
numeric vector of probabilities with values in |
na.rm |
logical; if true, any |
type |
numeric, 1 for no interpolation, or 7, for interpolated quantiles. Default is 7. |
weights |
numeric vector of non-negative weights, the same length as
|
... |
Additional arguments, currently ignored |
stat_ewcdf
# Some random numbers
x <- rnorm(100)
# Plain quantiles:
quantile(x)
# Larger values given larger weight, on average shifting the quantiles upward:
wquantile(x, weights = sort(runif(length(x))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.