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@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.


______________________________________________
R-help@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.

Reply via email to