繁体   English   中英

基本示例不适用于ffbase-package中的ffwhich

[英]Basic example not working for ffwhich from the ffbase-package

我正在尝试使用OHDSI: SelfControlledCaseSeries软件包的版本,该版本利用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")

有想法该怎么解决这个吗?

在软件包的git hub上报告了类似的错误。 似乎与操作系统有关(Windows 10?)。 @jwijffels在注释中提供了原因:

我自己还没有Windows 10机器,但是问题显然来自ff :: chunk,即来自ff :: chunk.ff_vector,其定义如下

相关的部分是:b <-BATCHBYTES%/%RECORDBYTES。 显然,您计算机上的此计算给出了23058430092136940,其原因超出了我的理解(假设您报告说它可以在Rgui上运行,而不能在RStudio上运行)。

您可以通过将ffbatchbytes选项更改为类似此选项的方式来解决此问题(ffbatchbytes = 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 #output

暂无
暂无

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

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