arules
需要交易清单。列表中的每一行都将包含一个产品数组。并非每笔交易都有相同数量的产品。这听起来像支点,但事实并非如此。一个例子可以在这里找到
我想要
aggregate(dvd , by=list("ID"), FUN=c)
失败的东西arguments must have same length
这是我的数据
> dvd
ID Item
1 1 Sixth Sense
2 1 LOTR1
3 1 Harry Potter1
4 1 Green Mile
5 1 LOTR2
6 2 Gladiator
7 2 Patriot
8 2 Braveheart
9 3 LOTR1
10 3 LOTR2
11 4 Gladiator
12 4 Patriot
13 4 Sixth Sense
14 5 Gladiator
15 5 Patriot
16 5 Sixth Sense
17 6 Gladiator
18 6 Patriot
19 6 Sixth Sense
20 7 Harry Potter1
21 7 Harry Potter2
22 8 Gladiator
23 8 Patriot
24 9 Gladiator
25 9 Patriot
26 9 Sixth Sense
27 10 Sixth Sense
28 10 LOTR
29 10 Galdiator
30 10 Green Mile
我需要一个看起来像这样的列表
TR1 c("Sixth Sense","LOTR1","Harry Potter1","Green Mile","LOTR2")
TR2 c("Gladiator","Patriot","Braveheart")
TR3 c("LOTR1","LOTR2")
....