title: subset sum in R
body: <p>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.</p>
  
  <p>For instance:</p>
  
  <p>subsets(4,3) should give me all combinations of 3 elements that sum up to 4:</p>
  
  <pre><code> 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
  </code></pre>
  
  <p>My sum will be 50 at most and my groups are fixed to 6 (where 0 is allowed).</p>
  
  <p>subsetsum() is not the answer to my problem unfortunately. Can anyone help me out?</p>