Is.subset在R中不起作用吗?

时间:2016-06-18 19:05:35

标签: r arules

require(arules)
Groceries <- read.transactions("C:/Users/IBM_ADMIN/Desktopgroceries.csv",sep=",")

 m1 <- apriori(Groceries,parameter=list(support=0.007,confidence=0.25,minlen=2))

subset.matrix <- is.subset(m1, m1)

#这条线不能正常工作

这会产生以下错误消息:

Error in match(x, table, nomatch = 0L) : 
  'match' requires vector arguments

请帮助我。

1 个答案:

答案 0 :(得分:0)

apriori返回规则对象,而不是向量:

data("Adult")
## Mine association rules.
rules <- apriori(Adult, 
    parameter = list(supp = 0.5, conf = 0.9, target = "rules"))
class(rules)
# [1] "rules"

如果要比较将此对象转换为data.frame所需的规则列表,例如:

rules.df <- as(rules, "data.frame")
is.subset(rules.df$rules, rules.df$rules)