如何重载函数" [< - .ffff"和" [。ffdf"来自包ff(在R中)?

时间:2014-05-12 08:57:05

标签: r overloading ff ffbase

我遇到过来自ff包的写入错误。 This answer表明解决方案可能是重载函数“[< - .ffff”和“[.ffdf”。有人可以详细说明这一点,或至少建议我需要弄清楚什么是必要的,以实现这一目标。请记住,这个问题来自新手。

2 个答案:

答案 0 :(得分:2)

只需重写" [< - .ffdf"和" [。ffdf"功能

require(ff)
## For the assignment
get("[<-.ffdf")
args(get("[<-.ffdf"))
"[<-.ffdf" <- function (x, i, j, value){
  ## put your code in here and make sure it does not open too many ff files which are in x
}
## For the getter
args(get("[.ffdf"))
"[.ffdf" <- function (x, i, j, drop = ncols == 1){
  ## put your code in here and make sure it does not open too many ff files which are in x
}

答案 1 :(得分:0)

另一种解决方案是增加系统设置,以允许同时打开更多文件。该系统设置是ff数据帧的限制因素。我解释了如何更改此设置on SO here