r语言 - 需要规则时使用的基本包。指定包不起作用

  • 本文关键字:不起作用 r语言 规则 r arules
  • 更新时间 :
  • 英文 :


我正试图在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包时,它确实说它屏蔽了基本的写函数:

library(arules)
Loading required package: Matrix
Attaching package: ‘arules’
The following objects are masked from ‘package:base’: abbreviate, write

我已经尝试再次安装arules程序包。我在Rstudio服务器(1.1.414(中使用R 3.5.1。

有什么帮助吗?

检查dfSingle,如果不是"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)

相关内容

  • 没有找到相关文章

最新更新