I am in desperate need of some help. All of a sudden 2 of my files got corrupted for no apparent reason. A few hours ago I was using them, and the next thing I know, I got this message...
WARNING: Failed to restore workspace from 'D:/R/R_HOME/.RData' Reason: bad restore file magic number (file may be corrupted) -- no data loaded
The file is now completely blank even though the file size remains the same.
Can someone please help me restore these files. These files amount to months of my hard work. Pleas help me.
Thank you for your response. The message that I received was common for both. As soon as I opened the R Workspace, I got that message in the console. In normal circumstances those two files are alwalys saved and restored as soon as I open the R session. But this time around, instead of showing me the content, R displayed this error, along with these 2 R files with content fully erased.
Alright then. Lets assume that you don't have backups or the ability to restore the file to a previous state. so it may be the unfortunate case that this workspace is truly corrupted and therefore gone for all intents and purposes.
However, the workspace is a snapshot of a sessions contents, thus if you have code that made the sessions contents, presumably you could rerun the code and regenerate the data that was in the old session ?
Losing work, is always a painful lesson, those of us working with R/Rstudio long enough have had to learn to protect ourselves in various ways. I recommend using git to not only version control code, but to reliably restore it as needed. Also, I disable automatic workspace saving/loading. As I like to be in control of what is saved and loaded, and I treat project work that needs to be reproducible in such a way that I can generate the outputs assuming the inputs are available, and then I can reduce the requirements to back up large amounts of data, to just key input datasets that can not be replaced.
I'm sorry that this future looking advice is the best I can offer you with regard to the workspace session you have seemingly lost.
I have never had this problem but there may be some hope if the file size remains the same. What is D:? A personal drive or off-site/cloud storage?
When did you get the warning? Are the files loading automatically on start-up of the R session or are you issuing a load() command?
When you say the file is blank, what program did you use to open it?
Is this of any use?
On the off-chance that you are running into a local problem and assuming the files are not confidential you might want to upload one or both to a file hostingsite such as Dropbox https://www.dropbox.com or MediaFire https://www.dropbox.com and post a download link here.