0

I have a large dataset that tells me which products each customer purchases. I want to know the most common combinations of products that customers purchase. So, it would return say, "27 customers purchase bananas and oranges", "45 customers purchase oranges and apples". Any idea how I would handle these combination counts in R?

Edit:

df would look like this:

Customer    Product 
A   Banana
A   Orange
A   Apple
B   Banana
B   Orange
B   Apple
C   Banana
C   Orange
C   Apple
C   Peach
C   Pear 
C   Plum

I would want it to return:

Customers With this combo   Product Count   Products Taken
2                               3           Banana, Orange, Apple
1                               5           Banana, Orange, Apple, Peach, Pear, Plum
David Arenburg
  • 91,361
  • 17
  • 137
  • 196
Tom
  • 11
  • 2
  • 2
    It would be best to give a sample of the data so people can get a better idea of the question – jalapic Feb 09 '16 at 03:20
  • 1
    This is essentially the same as this question, but replacing Event with Customer - http://stackoverflow.com/questions/35281488/creating-a-data-frame-of-the-number-of-pairings-based-on-an-event-column/35282553 – thelatemail Feb 09 '16 at 03:22
  • See [here](http://stackoverflow.com/questions/15933958/collapse-concatenate-aggregate-a-column-to-a-single-comma-separated-string-w) – David Arenburg Feb 09 '16 at 12:57

0 Answers0