-7
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)

#this piece of line is not working

This produces the following error message:

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

Please do help me.

  • 3
    Your question does not contain a [reproducible example](http://stackoverflow.com/q/5963269/4303162). It is therefore hard to understand your problem and give you an appropriate answer. Please make your data available (e.g. by using `dput()`) or use one of the example data sets in R. Also, add the minimal code required to reproduce your problem to your post. – Stibu Jun 18 '16 at 19:13

1 Answers1

1

apriori returns rules object, not a vector:

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

if you want to compare lists of rules you will need to transform this object to a data.frame, e.g.:

rules.df <- as(rules, "data.frame")
is.subset(rules.df$rules, rules.df$rules)
Bulat
  • 6,869
  • 1
  • 29
  • 52
  • Thanks for the reply, Bulat. My query is now resolved. But i have got another query. The following piece of code is not working: subset.matrix <- is.subset(rules.df$rules, rules.df$rules) subset.matrix[lower.tri(subset.matrix, diag=T)] <- NA redundant <- colSums(subset.matrix, na.rm=T) >= 1 – Venugopal Bukkala Jun 18 '16 at 19:43
  • 1
    you need to find out from which module `is.subset` function that you are using. – Bulat Jun 18 '16 at 20:04
  • 1
    Hi Bulat, i used 'rje' package but especially the last line "redundant <- colSums(subset.matrix, na.rm=T) >= 1" does not execute. – Venugopal Bukkala Jun 18 '16 at 22:19
  • Can you raise another question here on so for the new issue. – Bulat Jun 19 '16 at 07:40