title: Generate all combinations (and their sum) of a vector of characters in R
body: <p>Suppose that I have a vector of length <code>n</code> and I need to generate all possible combinations and their sums. For example:</p>
  
  <p>If <code>n=3</code>, we have:</p>
  
  <pre><code>myVec &lt;- c("a", "b", "c")
  
  Output = 
  "a"
  "b"
  "c"
  "a+b"
  "a+c"
  "b+c"
  "a+b+c"
  </code></pre>
  
  <p>Note that we consider that <code>a+b = b+a</code>, so only need to keep one.</p>
  
  <p>Another example if <code>n=4</code>,</p>
  
  <pre><code>myVec &lt;- c("a", "b", "c", "d")
  
  Output:
  "a"
  "b"
  "c"
  "d"
  "a+b"
  "a+c"
  "a+d"
  "b+c"
  "b+d"
  "c+d"
  "a+b+c"
  "a+c+d"
  "b+c+d"
  "a+b+c+d"
  </code></pre>