[R] How to choose a number subset with sum closest to x?

Dimitri Shvorob dimitri.shvorob at gmail.com
Sat Jan 30 00:06:42 CET 2010


I am looking for a function that, when supplied a vector of floats x,  an
integer n, and float s, would find me an n-subset of x with the sum closest
to s. Can anyone point me to a package/function that can do the job - better
yet, provide a relevant code sample? (There are a few relevant packages on
CRAN, but lack of examples in their docs is a real problem).

Thank you.    
-- 
View this message in context: http://n4.nabble.com/How-to-choose-a-number-subset-with-sum-closest-to-x-tp1439939p1439939.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list