title: How do I create a matrix consisting of all combinations (sums) of a given set of vectors?
body: <p>Suppose I have three (row) vectors:</p>
  
  <pre><code>x1 = c(0, 1, 0, 1, 0)    
  x2 = c(1, 2, 3, 4, 5)    
  x3 = c(2, 3, 4, 5, 6)
  </code></pre>
  
  <p>I want all possible sums <code>c1*x1 + c2*x2 + c3*x3</code> where the <code>c(i)</code>  are either zero or one.  Obviously there are eight such combinations.  I'm looking to do this in R on a much larger scale (with 8 vectors so a 256 row matrix), but I'm a coding amateur and am struggling.</p>