arulesViz下标越界paracoord

时间:2019-01-11 22:24:00

标签: r statistics associations arules

我想执行购物篮分析并绘制paracoord图,但是收到错误消息。

此错误的内容是::

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)

我正在使用来自Link的数据。

首先,我将其转换为适合篮子分析的格式,原始Excel文件的名称为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)

为了绘制paracoord,我创建了这样的代码:

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

为什么我的paracoord代码不起作用?我该如何解决?我应该改变什么?

1 个答案:

答案 0 :(得分:1)

不幸的是,这是arulesViz中的错误。此问题将在下一发行版(arulesViz 1.3-3)中修复。该修补程序已在GitHub的开发版本中提供:https://github.com/mhahsler/arulesViz