我在R中使用包arules来生成关联规则.我想限制规则,以便在左侧只有一个特定的元素,让我们称之为"potatoe".
如果我这样做:
rules <- apriori(dtm.mat, parameter = list(sup = 0.4, conf =
0.9,target="rules"), appearance = list(lhs = c("potatoe")))
Run Code Online (Sandbox Code Playgroud)
我在lhs上得到"potatoe",但也包括所有其他类型的东西.如何强制规则只包含一个元素?参数maxlen没有做我想要的,因为,据我所知,我不能指定应用于左边元素的maxlen.