Anika Masters
2013-Dec-06 19:47 UTC
[R] quantiles with approximately the same number of data points within each quantile?
What is a "good" way to create quantiles with approximately the same number of data points within each quantile?
Don McKenzie
2013-Dec-06 20:07 UTC
[R] quantiles with approximately the same number of data points within each quantile?
By default I believe. See http://en.wikipedia.org/wiki/Quantile Others more erudite may correct me. On Dec 6, 2013, at 11:47 AM, Anika Masters <anika.masters at gmail.com> wrote:> 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.Don McKenzie Research Ecologist Pacific Wildland Fire Science Lab US Forest Service Affiliate Professor School of Environmental and Forest Sciences University of Washington dmck at uw.edu
Rui Barradas
2013-Dec-06 20:25 UTC
[R] quantiles with approximately the same number of data points within each quantile?
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. >