[R] Looping over subsets

Z. Fang zf216 at cam.ac.uk
Sun Jan 20 07:53:45 CET 2008


Possibly a dumb question, but I wonder if anyone can help me with this. 
What I want to do, essentially, is to loop over all ordered subsets of a 
given size of a certain set. Ultimately, the idea is to find the subset 
that maximises a certain value.

The set in question is likely large (the subset size is likely small, 
though), so things like combn don't seem to be a good solution. The biggest 
concern is keeping memory usage sane, but processing time is also fairly 

Any ideas?

Zhou Fang

More information about the R-help mailing list