title: How to combine multiple columns of an r data frame into a single column that is a list
body: <p>I would like to combine multiple columns that I have in a data frame into one column in that data frame that is a list. For example, I have the following data frame ingredients:</p>
  
  <pre><code>name1 name2 imgID attr1 attr2 attr3...
  Item1 ItemID1 Img1 water chocolate soy...
  Item2 ItemID2 Img2 cocoa spice milk...
  </code></pre>
  
  <p>I would like to combine the attr columns into one column that is a comma-separated list of those items and if possible have them appear in the following format:</p>
  
  <pre><code>name1 name2 imgID attrs
  Item1 ItemID1 Img1 c("water", "chocolate", "soy", ...)
  Item2 ItemID2 Img2 c("cocoa", "spice", "milk", ...)
  </code></pre>
  
  <p>Is there a succinct way to write the code using a paste or join that allows me to call the columns of the data frame as <code>ingredients[4:50]</code> rather than each one by name? Is there also a way to not include <code>NA</code> or <code>NULL</code> values in that list?</p>