title: reshape a data frame with repeating rows
body: <p>I have a data frame that looks like this:</p>
  
  <pre><code>master_bill_no  category
  SBA5100008  CONDOMS
  SBA5100008  HAND CREAM
  SBA5100009  PREGNANCY TESTS
  SBA5100010  MULTI VITAMINS &amp; MIN
  SBA5100010  CALCIUM PREPARATIONS
  SBA5100010  VITAMINS
  SBA5100010  BETABLOCKERS
  </code></pre>
  
  <p>a reproducible example is given below:</p>
  
  <pre><code>structure(list(master_bill_no = c("SBA5100008", "SBA5100008", 
  "SBA5100009", "SBA5100010", "SBA5100010", "SBA5100010", "SBA5100010"
  ), category = c("CONDOMS", "HAND CREAM", "PREGNANCY TESTS", "MULTI VITAMINS &amp; MIN", 
  "CALCIUM PREPARATIONS", "VITAMINS", "BETABLOCKERS")), .Names = c("master_bill_no", 
  "category"), class = "data.frame", row.names = c(NA, -7L))
  </code></pre>
  
  <p>For each unique master bill no, i am trying to reshape the column category to a wide one.</p>
  
  <p>For example, the desired output would be:</p>
  
  <pre><code>master_bill_no  category
  SBA5100008  CONDOMS,HAND CREAM
  SBA5100009  PREGNANCY TESTS
  SBA5100010  MULTI VITAMINS &amp; MIN,CALCIUM PREPARATIONS,CALCIUM PREPARATIONS,BETABLOCKERS
  </code></pre>
  
  <p>I used the base reshape formula, and it just deletes the category column.  </p>
  
  <pre><code>reshape(df, idvar = "master_bill_no", timevar = "category", direction = "wide")
  </code></pre>
  
  <p>I tried aggregate function:</p>
  
  <pre><code>aggregate(df, master_bill_no, FUN = paste(category, sep = ","))
  </code></pre>
  
  <p>This returns a error message "object category not found"</p>
  
  <p>I am sure the reason for this is reshape is looking for values to fill which is missing.  Can someone help please?</p>