簡體   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