我正在尝试从不同的进程同时加载一堆 RData 文件。例如:
# script1.R
for (i in 1:1000) x <- get(load(sprintf('file%d.RData', i)))
# script2.R
for (i in 1:1000) x <- get(load(sprintf('file%d.RData', i)))
# from terminal:
> Rscript script1.R &
> Rscript script2.R
但是,当两个进程同时读取文件时,会出现两种不同的错误:
# error msg 1
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warnings message:
file 'file345.RData' has magic number ''
Use of save versions prior to 2 is deprecated
...
# error msg 2
Error: error reading from connection
...
我正在使用 Microsoft R Open 3.3.0 在 CentOS6 上运行上述代码。这是我第一次看到这种情况。有谁知道出了什么问题?