简体   繁体   English

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

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

I'm trying to use OHDSI:s version of the SelfControlledCaseSeries package, which utilizes the ff package to handle big data. 我正在尝试使用OHDSI: SelfControlledCaseSeries软件包的版本,该版本利用ff软件包来处理大数据。 But something is not working with the ffwhich function. 但是ffwhich函数无法正常工作。 Running the following example, provided in the ffwhich documentation: 运行下面的例子中,在提供ffwhich文档:

install.packages("ff")
install.packages("ffbase")
x <- ff::ff(10:1)
idx <- ffbase::ffwhich(x, x < 5)

gives me 给我

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

I have tried setting batchbytes to something smaller, running the script on another computer and also changed the location where ff-files are stored, but the error remains. 我尝试将batchbytes设置为较小的值,在另一台计算机上运行该脚本,还更改了ff文件的存储位置,但错误仍然存​​在。

options("ffbatchbytes"=  getOption("ffmaxbytes")/2)
options(fftempdir="C:/Users/OskarG/Desktop/ff_files")

Any ideas on how to fix this? 有想法该怎么解决这个吗?

A similar error was reported on the package's git hub . 在软件包的git hub上报告了类似的错误。 Appears to be an issue with operating system (Windows 10?). 似乎与操作系统有关(Windows 10?)。 @jwijffels provides the reason in the comments: @jwijffels在注释中提供了原因:

Haven't got windows 10 machine myself but the problem clearly comes from ff::chunk, namely from ff::chunk.ff_vector which is defined as follows 我自己还没有Windows 10机器,但是问题显然来自ff :: chunk,即来自ff :: chunk.ff_vector,其定义如下

The relevant part is this: b <- BATCHBYTES%/%RECORDBYTES. 相关的部分是:b <-BATCHBYTES%/%RECORDBYTES。 This calculation apparently on your machine gives 23058430092136940 for reasons beyond my understanding (given that you report it works on Rgui but not on RStudio). 显然,您计算机上的此计算给出了23058430092136940,其原因超出了我的理解(假设您报告说它可以在Rgui上运行,而不能在RStudio上运行)。

You could probably get around on this by changing option ffbatchbytes to something like this options(ffbatchbytes = 84882227) - which is the number I have on my oldskool windows 7 您可以通过将ffbatchbytes选项更改为类似此选项的方式来解决此问题(ffbatchbytes = 84882227)-这是我在oldskool Windows 7上拥有的数量

I was able to reproduce your error and correct it using the above suggestion: 我能够重现您的错误,并使用上述建议进行了更正:

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