I'm trying to find frequent itemsets of a data set using arules package .i found this example but it doesn't work for me .
ID <- c("A123","A123","A123","A123","B456","B456","B456")
item <- c("bread", "butter", "milk", "eggs", "meat","milk", "peas")
df <- data.frame(ID = ID, item = item)
library(arules)
trans <- as(split(df$item, df$ID), "transactions")
the result that i want is :
# items transactionID
# 1 {bread,butter,eggs,milk} A123
# 2 {meat,milk,peas} B456
i'm getting this error :"Error in df$item : object of type 'closure' is not subsettable"