我有一个大型数据集,告诉我每个客户购买的产品。我想知道客户购买的最常见的产品组合。因此,它会回来说“27位顾客购买香蕉和橙子”,“45位顾客购买橙子和苹果”。知道如何在R中处理这些组合计数吗?
编辑:
df看起来像这样:
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
我希望它返回:
Customers With this combo Product Count Products Taken
2 3 Banana, Orange, Apple
1 5 Banana, Orange, Apple, Peach, Pear, Plum