[R] quantiles with approximately the same number of data points within each quantile?

Rui Barradas ruipbarradas at sapo.pt
Fri Dec 6 21:25:12 CET 2013


Hello,

Use function ?quantile.
See this example, each group has exactly, not approximately, 25 elements.

x <- rnorm(100)

qnt <- quantile(x)
tapply(x, findInterval(x, qnt, rightmost.closed = TRUE), length)

Hope this helps,

Rui Barradas

Em 06-12-2013 19:47, Anika Masters escreveu:
> What is a "good" way to create quantiles with approximately the same
> number of data points within each quantile?
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list