> I hope I have missed a better way to do this in R. Otherwise, I > believe what I'm after is some kind of C or C++ macro expansion, > because the number of loops should not be hard coded. Why not generate the list of integers that sum to 17, and then mix with 0s as appropriate? Hadley -- http://had.co.nz/