pDistr | R Documentation |
Internal soundgen function.
pDistr(x, quantiles)
x |
numeric vector of non-negative real numbers |
quantiles |
quantiles of the cumulative distribution |
Calculates the values in the input distribution that contain particular proportions of the sum of all values in the input distribution.
x = rnorm(100)
x = x - min(x) # must be non-negative
hist(x)
v = soundgen:::pDistr(x, quantiles = c(.5, .8, .9))
sum(x[x > v['0.5']]) / sum(x)
sum(x[x > v['0.9']]) / sum(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.