简体   繁体   English

如何从函数包ff(在R中)重载函数“[< - 。ffdf”和“[.ffdf”]?

[英]How to overload the functions “[<-.ffdf” and “[.ffdf” from package ff (in R)?

I've experienced the write error from ff package. 我遇到过来自ff包的写入错误。 This answer suggests that the solution could be to overload the functions "[<-.ffdf" and "[.ffdf". 这个答案表明解决方案可能是重载函数“[< - 。ffdf”和“[.ffdf”。 Could somebody elaborate this in more details, or at least suggest what I need to figure out to understand what is necessary to accomplish this. 有人可以详细说明这一点,或至少建议我需要弄清楚什么是必要的,以实现这一目标。 Keep in mind that this the question comes from a novice. 请记住,这个问题来自新手。

Just rewrite the "[<-.ffdf" and "[.ffdf" functions. 只需重写“[< - 。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
}

An alternate solution would be to increase your systems setting to allow for more files to be open simultaneously. 另一种解决方案是增加系统设置以允许同时打开更多文件。 That system setting is the limiting factor for the ff data frame. 该系统设置是ff数据帧的限制因素。 I explained how to change this setting on SO here . 在这里解释了如何在SO上更改此设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM