When running the code of this example I'm getting the following error in the last line:
Error in matrix(mean(range), ncol = ncol(x), nrow = nrow(x), dimnames
= dimnames(x)) : non-numeric matrix extent
However, I remember having seen other cases some months ago where the library arulesViz worked whit categorical data type.
landing.data=read.csv2("http://archive.ics.uci.edu/ml/machine-learning-databases/shuttle-landing-control/shuttle-landing-control.data",
sep=",", header=F, dec=".")
landing.data=as.data.frame(sapply(landing.data,gsub,pattern="\\*",replacement=10))
library(arules)
landing.system <- as(landing.data, "transactions")
rules <- apriori(landing.system, parameter=list(support=0.01, confidence=0.6))
rulesLandingManual <- subset(rules, subset=rhs %in% "V1=1" & lift>1.2)
library(arulesViz)
plot(head(sort(rulesLandingManual, by="confidence"), n=3),
method="graph",control=list(type="items"))
Best Answer
Doing a
traceback()
after running your code gives this:So, basically the error comes from
6:
. And the error implies that any of the argumentmatrix(.)
are not numeric. To illustrate this:You see the error? I don't think there's nothing much YOU can do here as the package extends
graph
,map
andmatrix
to objects of classrules
. So, this probably has a lot to do with the developer side. If it is indeed the case, probably it is worth writing/contacting the developers.