[R] corrupted data/ naive fix that worked

S.McClatchie s.mcclatchie at niwa.cri.nz
Wed Dec 12 23:19:42 CET 2001

System info:
R Version 1.3.1  (2001-08-31) on Windows 2000
ESS v. 5.1.18 using emacs ver. 20.7.1


On 11 Dec 2001,, R-help Digest wrote (re: R-help Digest V2 #598): 

> Apparently, the system shutdown has hurt the .RData file
> somehow. Is there a way of restoring the information at
> least partially without too much trouble? 

I have occassionally had a corrupted .RData file which initially seemed 
disastrous, but was fairly easily (if tediously) fixed.

(1) I renamed the .RData and .Rhistory files (old.RData etc.)

(2) in the R-src subdirectory I found the scripts I needed to reload (e.g 
smc.multiple.regression.Hg.weight.3.R or 
smc.multiple.regression.Hg.weight.3.R~). They are ascii so you can just 
use a text editor to find what you need.

(3)  I loaded the R-objects back into the workspace one by one (using 
Control C-D under ESS). Strip the filename (smc. 
multiple.regression.Hg.weight.3.R) of the prefix and suffix (smc. and the 
.R) (i.e. Ctrl C-D multiple.regression.Hg.weight.3). Then submit the file 
(using CTRL C-L).
You will now have that object in the workspace:
> objects()
[1] "multiple.regression.Hg.weight.3"

(4)  When I exited R or do a save.image() the .RData was recreated.

This is far from elegant, but when I had done something foolish, it saved 
my bacon.

Best wishes


Sam McClatchie, 
Research scientist (fisheries acoustics))))))))))

NIWA (National Institute of Water & Atmospheric Research Ltd)
Postal address: PO Box 14 901, Kilbirnie, Wellington, New Zealand. 

Street address: 301 Evans Bay Parade, Greta Point, 6003 Wellington, New Zealand.

Email: s.mcclatchie at niwa.cri.nz, 
phone 64-04-386-0574, FAX: 64-4-386 0574. 

...>><xX(°> // \\
                 /// \\\   
                //// \\\\
               ///  <°)Xx><<
              /////  \\\\\\
  >><(((°>   ...>><xX(°>O<°)Xx><<

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list