[R] Binning question (binning rows of a data.frame according to a variable)
hadley wickham
h.wickham at gmail.com
Mon Mar 20 01:41:52 CET 2006
> Thing is, for one reason or another, the number of marbles per bag may
> systematically vary with age too. However, I am not interested in the
> number of marbles per bag, so I would like to group the students into 8
> groups such that each group has the same total number of marbles. (Each
> group having a different sized age range, none the less ordered by age).
This sounds very much like a bin-packing problem
(http://en.wikipedia.org/wiki/Bin_packing_problem), which is NP-hard.
The wikipedia page mentions some heuristics you may want to look into.
Hadley
More information about the R-help
mailing list