我正在尝试进行子集化,以使 rhs 和 lhs 上的所有项目都设置为 1,但这不起作用。有没有其他方法可以确保我在规则的 LHS 和 RHS 上的项目都只是“1”?我使用了以下代码。
rules = apriori(cosdat1, parameter=list(support=0.28, confidence=0.3, minlen=2, target="rules"))
summary(rules)
rules.sub <- subset(rules, subset = lhs %in% c("Bag=1","Blush=1","Nail.Polish=1","Brushes=1","Concealer=1","Eyebrow.Pencils=1","Bronzer=1","Lip.liner=1","Mascara=1","Eye.shadow=1","Foundation=1","Lip.Gloss=1","Lipstick=1","Eyeliner=1"));
rules.sub
rules.sub1 <- subset(rules, subset = rhs %in% c("Bag=1","Blush=1","Nail.Polish=1","Brushes=1","Concealer=1","Eyebrow.Pencils=1","Bronzer=1","Lip.liner=1","Mascara=1","Eye.shadow=1","Foundation=1","Lip.Gloss=1","Lipstick=1","Eyeliner=1"));
rules.sub1