Transform csv into transactions for arules [duplicate]

本秂侑毒 提交于 2019-12-06 15:41:28

If we consider the column EMAIL as a sort of transaction ID, we can transform your data.frame to class transactions by:

library(arules)
trans <- as(split(df[,"BRAND"], df[,"EMAIL"]), "transactions")

# To explore the rules we could do
rules <- apriori(trans)
inspect(rules)
#  lhs        rhs     support confidence lift
#1 {levis} => {nike}  0.5     1          2   
#2 {nike}  => {levis} 0.5     1          2   
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!