Search code examples
rstatisticsassociationsarules

arulesViz subscript out of bounds paracoord


I want to perform basket analysis and draw a paracoord plot however I receive an error.

Content of this error is: :

Error in m[j, i] : subscript out of bounds.In addition: Warning message:
In cbind(pl, pr) :
number of rows of result is not a multiple of vector length (arg 2)

I am using data from: Link.

First I am transforming this to fit basket analysis, name of the original excel files is Online_Retail:

library(arules)
library(arulesViz)
library(plyr)
items <- ddply(Online_Retail, c("CustomerID", "InvoiceDate"),             function(df1)paste(df1$Description, collapse = ","))
items1 <- items["V1"]
write.csv(items1, "groceries1.csv", quote=FALSE, row.names = FALSE, col.names = FALSE)

trans1 <- read.transactions("groceries1.csv", format = "basket", sep=",",skip=1)

And to draw paracoord I have created such a code:

rules.trans2<-apriori(data=trans1, parameter=list(supp=0.001,conf = 0.05), 
                  appearance=list(default="rhs", lhs="ROSES REGENCY TEACUP AND SAUCER"), control=list(verbose=F)) 

sorted.plot <- sort(rules.trans2, by="support", decreasing = TRUE)
plot(sorted.plot, method="paracoord", control=list(reorder=TRUE, verbose = TRUE))

Why my code for paracoord is not working? how can I fix it? What should I change?


Solution

  • This is, unfortunately, a bug in arulesViz. This will be fixed in the next release (arulesViz 1.3-3). The fix is already available in the development version on GitHub: https://github.com/mhahsler/arulesViz