You can split a vector into groups with equal numbers using the quantcut function in the gtools package. For example, to split into two groups, use:
c <- quantcut(y,c(0,.5,1)) On 26/05/07, J. Scott Olsson <[EMAIL PROTECTED]> wrote: > Suppose I have some data > > >x <- rnorm(1000); > >y <- x*x; > > then try to cut it into 2 chunks, > > >c <- cut(y, breaks=2); > > >summary(y) > Min. 1st Qu. Median Mean 3rd Qu. Max. > 6.879e-06 9.911e-02 3.823e-01 9.499e-01 1.297e+00 8.342e+00 > > >summary(c) > (-0.00833,4.17] (4.17,8.35] > 958 42 > > Is that the correct behavior? Why is the left hand side of the interval > negative? > > How would I split a data vector into groups/intervals such that each > interval contained the same number of points? > > > Thanks much! > Scott > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > -- ================================= David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP ______________________________________________ R-help@stat.math.ethz.ch 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.