【发布时间】:2021-05-02 02:40:37
【问题描述】:
library(arules)
library(arulesViz)
library(RColorBrewer)
trans = read.transactions("https://raw.githubusercontent.com/tempAcccc/temRepo/main/TempFile.csv",format="basket", sep = ",",cols = c(1))
rule1 <- apriori(trans, parameter = list(support = 0.004,conf=0.05,target="rules"))
plot(rule1, measure=c("support", "confidence"),shading="order",col = brewer.pal(4,"Spectral"),main="Rules with Min_sup=0.004 and Min_conf=0.05")
此代码生成。
我想将它说顺序的部分更改为“迭代”我该怎么做?
【问题讨论】:
-
如果您包含一个简单的reproducible example 以及可用于测试和验证可能的解决方案的示例输入,则更容易为您提供帮助。
-
@MrFlick 我已添加数据框,以便您重现结果。
-
如果您使用基础 R 之外的函数,您应该命名所需的包。另外,对我来说,
read.transactions()不适用于从环境中读取 DF。我必须直接从源代码读取文件。我在你的帖子中编辑了这两个。虽然arulesViz的文档说In addition to using order for shading, we also give the plot a different title (main). Othercontrol options includingpch(best with filled symbols: 20–25),cex,xlimandylimareavailable and work in the usual way expected by R-users.,但在我看来,更改图例标签是不可能的。