我正在尝试使用SelfControlledCaseSeries包的OHDSI:s版本,它利用ff包来处理大数据。但是ffwhich函数不起作用。运行ffwhich文档中提供的以下示例:
install.packages("ff")
install.packages("ffbase")
x <- ff::ff(10:1)
idx <- ffbase::ffwhich(x, x < 5)给我
Error in if (by < 1) stop("'by' must be > 0") :
missing value where TRUE/FALSE needed
In addition: Warning message:
In chunk.default(from = 1L, to = 5L, by = c(integer = 46116860184273880), :
NAs introduced by coercion to integer range我尝试过将batchbytes设置为更小的东西,在另一台计算机上运行脚本,并更改了储存ff文件的位置,但错误仍然存在。
options("ffbatchbytes"= getOption("ffmaxbytes")/2)
options(fftempdir="C:/Users/OskarG/Desktop/ff_files")有什么办法解决这个问题吗?
发布于 2019-09-19 02:57:15
在包的git轮毂上也报告了类似的错误。似乎是操作系统的问题(Windows 10?)。@jwijffels在评论中提供了原因:
我自己还没有windows 10机器,但问题显然来自ff::which,即来自ff::chunk.ff_vector,定义如下 相关部分为:B <- BATCHBYTES%/%RECORDBYTES。这种计算显然在您的机器上给出了23058430092136940,原因超出了我的理解(考虑到您报告它在Rgui上工作,而在RStudio上不起作用)。 您可能可以通过将选项ffbatch字节更改为类似于此选项(ffbatch字节= 84882227)来解决这一问题--这是我在我的oldskool windows 7上的数字。
我能够复制您的错误并使用上述建议进行更正:
library("ff")
library("ffbase")
options(ffbatchbytes = 84882227) #add this line in
x <- ff::ff(10:1)
idx <- ffwhich(x, x < 5)
x[idx][]
[1] 4 3 2 1 #outputhttps://stackoverflow.com/questions/57992267
复制相似问题