r-help Forum
I'm using the following code to sort the "right-hand side (rhs, consequent) of the rules output from the arules packages, which works. But what I'd really like is the ability to subset my rules where the rhs = "some item set" rules_info <- data.frame( LHS = labels(lhs(rules)), RHS = labels(rhs(rules)), quality(rules) ) rules_info[ order(rules_info$RHS=), ] For example using my code above I'm able to sort as follow's 179 {Cereals,Eggs,Tomatoes,Vinegar} {Bread} 0.1428571 1.0000000 1.1666667 1 184 {Eggs,Milk,Pork,Sugar} {Bread} 0.1428571 1.0000000 1.1666667 1 189 {Eggs,Milk,Pork,Tomatoes} {Bread} 0.1428571 1.0000000 1.1666667 1 1 {} {Cereals} 0.2857143 0.2857143 1.0000000 2 8 {Vinegar} {Cereals} 0.1428571 1.0000000 3.5000000 1 15 {Tomatoes} {Cereals} 0.1428571 0.5000000 1.7500000 1 17 {Eggs} {Cereals} 0.2857143 0.3333333 1.1666667 2 But what I'd really like to do is just get (say) {Bread} like . LHS RHS support confidence lift count 179 {Cereals,Eggs,Tomatoes,Vinegar} {Bread} 0.1428571 1.0000000 1.1666667 1 184 {Eggs,Milk,Pork,Sugar} {Bread} 0.1428571 1.0000000 1.1666667 1 189 {Eggs,Milk,Pork,Tomatoes} {Bread} 0.1428571 1.0000000 1.1666667 1 Jeff Reichman [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.