基本示例不适用于 ffbase-package 中的 ffwhich
Basic example not working for ffwhich from the ffbase-package
我正在尝试使用 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")
关于如何解决这个问题有什么想法吗?
包的 git hub 上报告了类似的错误。似乎是操作系统的问题(Windows 10?)。 @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
The relevant part is this: 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).
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
我能够重现您的错误并使用上述建议进行更正:
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
我正在尝试使用 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")
关于如何解决这个问题有什么想法吗?
包的 git hub 上报告了类似的错误。似乎是操作系统的问题(Windows 10?)。 @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
The relevant part is this: 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).
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
我能够重现您的错误并使用上述建议进行更正:
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