0

I am new to stackoverflow so please take that into consideration when reading my question... thank you for your help.

I am trying to run the a priori function in R, but get the error:

cannot coerce list with transactions with duplicated names

I don't know if it is an issue with the way my data is formatted in the CSV file, or if I am missing a step in the program.

  1. Load CSV file
  2. mydata<-lapply(mydata, as.factor)
  3. rules<-apriori(mydata,parameter=list(supp=.01,conf=.7))

Error in asMethod(object) : can not coerce list with transactions with duplicated item

My data is formatted as a list of transactions with 1 or 0 for each product available (column):

product1....product15

1                 1

1                 0

0                 0

1                 1
Mouse on the Keys
  • 322
  • 1
  • 5
  • 13
MDIS
  • 1
  • 1

1 Answers1

0

You should convert your data set from integer to factor column by column. So change your second step to:

for (i in 1:15){
  mydata[,i]<-as.factor(mydata[,i])
}
Mark Olson
  • 55
  • 1
  • 4