[R] restore file magic number

Duncan Murdoch murdoch at stats.uwo.ca
Mon Sep 19 22:52:38 CEST 2005


On 9/19/2005 4:29 PM, Kristin_Cothern at URSCorp.com wrote:
> Hello,
> 
> I recently lost access to my workspace developed over a long time.  When I
> try to load this work space (called Casmalia.Rdata) or double click on it
> to open it in R, I see  a popup which says (Embedded image moved to file:
> pic17720.jpg)
> :
> And under this, the last line in the console commands is:   "Bad restore
> file magic number.  (File may be corrupted) - no data loaded."
> 
> The Casmalia.Rdata file looks the right size.  But is apparently missing a
> magic number.  Can this file be fixed in an editor such as Textpad so that
> it can be restored?

It's probably missing a lot more than a magic number.  That's just a 
signal that the file format isn't really an R workspace any more.

You need to get an old copy from a backup.

If you're desperate and short of a backup, you could try looking at the 
file in a binary dump program to see if there's anything left of the 
contents (perhaps only part of it got trashed), and maybe try to restore 
just the good stuff, but it's not going to be easy, and the only real 
documentation for what to do is to look at the R source code.

Duncan Murdoch




More information about the R-help mailing list