r - Filter of rhs with arules/apriori is not working -


i'm using arules::apriori binary matrix , want create rules have 1 particular column on rhs. specified in documentation doesn't seem work. easy enough filter post hoc waste lot of computational time calculating rules in first place.

example:

library(arules) data = data.frame(matrix(rbinom(10000,1, 0.6), nrow=1000)) for(i in 1:ncol(data)) data[,i] = as.factor(data[,i]) dsrules = as(data, "transactions") rules = apriori(dsrules,      parameter=list(support = 0.1, minlen = 3, maxlen = 3, target= "rules", confidence = 0.7),      appearance = list(rhs = c("x1=1"))) 

rules contains 3378 rules

rules.sub = subset(rules, subset = (rhs %pin% "x1=1")) 

rules.sub contains 172 rules

in actual data go millions of results ~4000 huge difference.

nsfy, there easier way this. need add default='lhs', in appearance=list(rhs='x1=1',default='lhs'). limit rhs x1=1.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -