【问题标题】:"bad restore file magic number" error in RR中的“坏恢复文件幻数”错误
【发布时间】:2013-05-08 09:40:26
【问题描述】:

What could cause a "bad magic number" error when loading an R workspace and how to avoid it?R has magic number 'ëPNG' error 中,我收到了一个bad restore file magic number 错误:

> load("fossilien.dat")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘fossilien.dat’ has magic number '"Samp'
   Use of save versions prior to 2 is deprecated 

使用source 函数给我一个不同的错误(类似于unexpected string constant):

> source("fossilien.dat")
Error in source("fossilien.dat") : 
  fossilien.dat:1:10: unexpected string constant
1: "Sample" "Sname"
            ^

这尤其令人沮丧,因为我确信数据来源是合法的 - 它是一个家庭作业问题:ftp://stat.ethz.ch/Teaching/Datasets/WBL/fossilien.dat

上面的 SO 问题都没有真正得到正确回答,所以我想我会再试一次。

关于我的 R 安装的一些细节:

> R.Version()
$platform
[1] "x86_64-apple-darwin9.8.0"
$version.string
[1] "R version 2.15.3 (2013-03-01)"

【问题讨论】:

    标签: r loading


    【解决方案1】:

    read.table 函数最终工作:http://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html

    > fossildata <- read.table("fossilien.dat")
    

    由 CGW 编辑:load 用于 .rdata 格式的文件,而您的 fossilien.dat 显然是一个 ASCII 表。 source 执行指定的文件或对象。

    【讨论】:

    • 如果你有一堆以 RData 格式保存的对象怎么办?
    猜你喜欢
    • 2019-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-07
    • 2017-03-04
    • 2010-10-05
    相关资源
    最近更新 更多