Sorting the rules by lift or confidence is,
> rules.sorted <- sort(rules, by="lift")
But is it possible to sort by two or three columns (i.e., sort by lift,confidence and support(in this order))? In order()
, we can sort based on any number of columns using comma. How to use that in sort()
in arules
package in R?
If I try this, I getting an following error,
> rules.sorted <- sort(rules, by=c("lift","confidence","support"))
> Error in .subset2(x, i, exact = exact) : recursive indexing failed at level 2
EDIT: You can find the process in following link http://www.rdatamining.com/examples/association-rules