我使用R(3.4.0)中的arules包添加关联规则挖掘。我已经给出了以下代码的简化版本:
library(arules)
data <- paste("trans1 apple", "trans2 apple","trans2 orange","trans3 apple","trans3 orange","trans3 banana", sep ="\n")
write(data, file = "demo_single_1")
tr <- read.transactions("demo_single_1", format = "single", cols = c(1,2))
basket_rules <- apriori(tr,parameter = list(sup = 0.01, conf = 0.01,target="rules"))
apriori命令抛出以下错误:
Apriori
Parameter specification:
confidence minval smax arem aval originalSupport maxtime support minlen
0.01 0.1 1 none FALSE TRUE 5 0.01 1
maxlen target ext
10 rules FALSE
Algorithmic control:
filter tree heap memopt load sort verbose
0.1 TRUE TRUE FALSE TRUE 2 TRUE
Absolute minimum support count: 0
Error in apriori(tr, parameter = list(sup = 0.01, conf = 0.01, target = "rules")) :
object 'R_rapriori' not found
加载包时没有错误。
有人可以指导我如何解决此错误吗?
答案 0 :(得分:1)
如果我运行你的代码,我会把它作为输出:
Apriori
Parameter specification:
confidence minval smax arem aval originalSupport maxtime support minlen maxlen
0.01 0.1 1 none FALSE TRUE 5 0.01 1 10
target ext
rules FALSE
Algorithmic control:
filter tree heap memopt load sort verbose
0.1 TRUE TRUE FALSE TRUE 2 TRUE
Absolute minimum support count: 0
set item appearances ...[0 item(s)] done [0.00s].
set transactions ...[3 item(s), 3 transaction(s)] done [0.00s].
sorting and recoding items ... [3 item(s)] done [0.00s].
creating transaction tree ... done [0.00s].
checking subsets of size 1 2 3 done [0.00s].
writing ... [12 rule(s)] done [0.00s].
creating S4 object ... done [0.00s].
没有任何错误。