[R] Arules: getting rules with only one item in the left-hand side

Laia Mayol laia.mayol at gmail.com
Tue May 21 13:42:05 CEST 2013


Hello,

I am using the package arules to generate association rules.  I would like
to restrict the rules so that in the left-hand side there's only one
particular element, let's call it "potatoe".

If I do this:
rules <- apriori(dtm.mat, parameter = list(sup = 0.4, conf =
0.9,target="rules"), appearance = list(lhs = c("potatoe")))

I get "potatoe" on the lhs, but also all other kinds of things. How can I
force that the rules contain only one element? The parameter maxlen don't do
what I want, because, as far as I can see, I cannot specify the maxlen to
apply to the elements on the left.

Thanks!

Laia



More information about the R-help mailing list