The cause of “bad magic number” error when loading a workspace and how to avoid it?

后端 未结 9 1291
自闭症患者
自闭症患者 2020-11-29 05:54

I tried to load my R workspace and received this error:

Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning m         


        
9条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 06:07

    Also worth noting the following from a document by the R Core Team summarizing changes in versions of R after v3.5.0 (here):

    R has new serialization format (version 3) which supports custom serialization of ALTREP framework objects... Serialized data in format 3 cannot be read by versions of R prior to version 3.5.0.

    I encountered this issue when I saved a workspace in v3.6.0, and then shared the file with a colleague that was using v3.4.2. I was able to resolve the issue by adding "version=2" to my save function.

提交回复
热议问题