-->

Apriori Algorithm - Create Plot

2019-08-28 20:44发布

问题:

I am working in R and I have the following problem with apriori.

I have a very similar code to this one (just using the grocery dataset): R - arules apriori Error in length(obj) : Method length not implemented for class rules

  1. I don't see the difference in the code between the question and the answer
  2. Even when I reduce confidence and support to 0 this error shows up when making a plot:

Error in length(object) : Method length not implemented for class itemsets

Here is my code:

data(Groceries)

rules<-apriori(data=Groceries, parameter=list(supp=0.001,conf = 0.15,minlen=2), 
               appearance = list(default="rhs",lhs="whole milk"),
               control = list(verbose=F))
rules<-sort(rules, decreasing=TRUE,by="confidence")
arules::inspect(rules[1:5])
plot(rules,method="graph",interactive=FALSE,shading=NA)

Your help will be appreciated,

PS: the code itself is not my own creation