[R] Binning question (binning rows of a data.frame according to a variable)

Dan Bolser dmb at mrc-dunn.cam.ac.uk
Mon Mar 20 11:53:19 CET 2006


hadley wickham wrote:
>>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

Man, I hate NP-hard problems!

Thanks for the link :)

Dan.




More information about the R-help mailing list