需要 arules 时使用的基础包。指定包不起作用

base package used when arules is required. Specifying package doesn't work

我正在尝试在arules 包中编写一个单一格式的文件,以便随后将其作为事务加载以进行关联规则挖掘。我不能使用这个函数,因为 R 一直在使用 base::write 函数而不是 arules::write 函数。

arules::write(x = dfSingle,
              file = "dfSingleFile",
              format = "single",
              quote = TRUE,
              sep = ",")

给出以下错误信息:

Error in base::write(x, file, ...) : 
unused arguments (format = "single", quote = TRUE)

当我在会话开始时加载 arules 包时,它确实说它屏蔽了来自 base 的写入函数:

library(arules)
Loading required package: Matrix

Attaching package: ‘arules’
The following objects are masked from ‘package:base’: abbreviate, write

我已经尝试再次安装 arules 软件包。我在 Rstudio Server (1.1.414) 中使用 R 3.5.1。

有什么帮助吗?

检查dfSingleclass,如果不是"transactions"则传给base::write,看示例:

library(arules)
data(Epub)

class(Epub)
# [1] "transactions"
# attr(,"package")
# [1] "arules"
arules::write(x = head(Epub),
              file = "test",
              format = "single",
              quote = TRUE,
              sep = ",")
# no errors!

class(mtcars)
#[1] "data.frame"
arules::write(x = mtcars,
              file = "test",
              format = "single",
              quote = TRUE,
              sep = ",")
# Error in base::write(x, file, ...) : 
#   unused arguments (format = "single", quote = TRUE)