Given a set of real numbers stored in a data frame df
under a column A
, and an element r
in this set, how would you solve the following 'equation' for q
:
r = quantile(df$A, q)
Thanks for any help.
Given a set of real numbers stored in a data frame df
under a column A
, and an element r
in this set, how would you solve the following 'equation' for q
:
r = quantile(df$A, q)
Thanks for any help.
In ?quantile
we can read
See Also
ecdf for empirical distributions of which quantile is an inverse
Thus:
x <- rnorm(100)
r <- quantile(x, 0.05)
# 5%
#-1.469996
Fn <- ecdf(x)
Fn(r)
#[1] 0.05