Why 0 rules in Apriori algorithm in R

141 Views Asked by At

I'm doing Association rule mining in R. This's the dataset I'm using enter link description here.enter image description here

And here's my code.I can't understand why I'm getting 0 rules.

library(readr)
Bakery <- read_csv("Bakery.csv")
View(Bakery)
summary(Bakery)

library(arules)
rules  <- apriori(Bakery)
summary(rules)

Then I'm getting this output.Pls help.enter image description here

1

There are 1 best solutions below

1
Mohanasundaram On

You have to convert the data frame into a transactions class to be used for arules. Try this:

Bakery_data <- as(split(Bakery[,"Items"], Bakery[,"TransactionNo"]), "transactions") 

rules  <- apriori(Bakery_data)