title: Combining variables together into a list
body: <p>Folks,</p>
  
  <p>I'm stumped with the following challenge. I have a data set that looks like this:</p>
  
  <pre><code>BuyerID    Fruit.1     Fruit.2    Fruit.3    Amount.1    Amount.2    Amount.3
  879        Banana      Apple                 4           3
  765        Strawberry  Apple      Orange     1           2           4
  123        Orange      Banana                1           1           1
   11        Strawberry                        3
  773        Kiwi        Banana                1           2
  </code></pre>
  
  <p>What I would like to do is to simplify the data (if possible) and collapse the "Fruit" and "Amount" variables</p>
  
  <pre><code>BuyerID    Fruit                             Amount      Total    Count
  879        "Banana" "Apple"                  4  3            7        2
  765        "Strawberry" "Apple" "Orange"     1  2  4         7        3
  123        "Orange" "Banana"                 1  1  1         3        2
   11        "Strawberry"                      3               3        1
  773        "Kiwi" "Banana"                   1  2            3        2
  </code></pre>
  
  <p>I have tried using c() and rbind() but they do not produce the results that I want - I've tried the tip here: <a href="https://stackoverflow.com/questions/3492379/data-frame-rows-to-a-list">data.frame rows to a list</a> as well but am not too sure whether this is the best way to simplify my data.</p>
  
  <p>This is so that presumably it would be easier for me to deal with fewer variables to count the occurrence of certain items for example (e.g. 60% buyers purchase Banana).</p>
  
  <p>I hope this is doable - am also open to any suggestions. Any solutions appreciated!</p>
  
  <p>Thank you.</p>