I'd like to have an algorithm (in r) that provides me with ALL possible combinations of integers that sum up to a certain sum. Preferably in a data.frame.
For instance:
subsets(4,3) should give me all combinations of 3 elements that sum up to 4:
 0,0,4
 0,4,0
 4,0,0
 1,0,3
 1,3,0
 3,0,1
 3,1,0
 0,1,3
 0,3,1
 1,1,2
 1,2,1
 2,1,1
 2,2,0
 0,2,2 
 2,0,2
My sum will be 50 at most and my groups are fixed to 6 (where 0 is allowed).
subsetsum() is not the answer to my problem unfortunately. Can anyone help me out?