0

I was wondering if anyone knows how to constrain the left and right hand sides in apriori (arules) by pointing to a .csv containing the constraints.

A very similar question was asked and answered in this post for anyone else struggling with something similar.

rules_sales <- apriori(sales, 
                       parameter=list(support=0.001, confidence=0.5, minlen=2, maxlen=2), 
                       appearance=list(lhs=c("HouseOwnerFlag=0", "HouseOwnerFlag=1"), 
                       rhs=paste0("Product=", unique(sales$Product)), default="none"))

However I have a fairly substantial list of constraints to apply and am trying to avoid typing or copying and pasting directly into R.

Thanks for looking!

Community
  • 1
  • 1
bg49ag
  • 143
  • 2
  • 5
  • Why not write you code in an editor or IDE than allows an #include call? Then just `source` the code. – IRTFM Dec 08 '16 at 20:35

1 Answers1

0

Verena Haunschmid provides the answer to this in Solution 2: of their post:

How to get items for both LHS and RHS for only specific columns in arules?

bg49ag
  • 143
  • 2
  • 5
  • Please have a look at [Can I answer my own question?](http://stackoverflow.com/help/self-answer) and come back two days later and check as answered. – help-info.de May 04 '17 at 18:41