我正在尝试从不同进程同时加载一堆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上运行上述代码。这是我第一次看到这个。有谁知道出了什么问题?