rules <- apriori(table2, parameter = list(minlen=1, sup=s))
itemsets <- unique(generatingItemsets(rules))
itemsets.df <- as(itemsets, "data.frame")
F <- as.matrix(itemsets.df[with(itemsets.df, order(-support,items)),])
输出:
# items support
"{a,b}" "1.0"
"{a}" "1.0"
"{b}" "1.0"
"{c,a,b}" "0.5"
"{c,a}" "0.5"
"{c,b}" "0.5"
"{a,b,d}" "0.5"
"{a,d}" "0.5"
"{b,d}" "0.5"
使用 apriori 和 generateItemsets 获取频繁事件集,如“items”所示。但在这种情况下,我只想要输出中的超集,即“{c,a,b}”和“{a,b,d}”。我该怎么做才能仅在 R 中获得超集?