I had a R script open in RStudio. The file was saved many times over the course of several weeks and worked perfectly fine when RStudio was opened and closed. However, today, I restarted my computer and when I opened RStudio and more specifically the script that I mentioned, all of the R code vanished, leaving a single long row of "....." with red highlighting.
When I tried to open the R file in other text processors such as Sublime Text and Notepad++, only a line of zeroes was visible. None of my other R files were affected. I'm currently running Windows 8.1 and have the latest version of R and RStudio. What can I do to recover the code in the file and prevent something like this from happening again?
WARNING: Failed to restore workspace from '~/CODES/OpenCanada.info/.RData' Reason: bad restore file magic number (file may be corrupted) -- no data loaded
. It was the last file that I edited that got corrupted. And Unfortunately, the history file was empty. But then I went to `C:\Users\%user%\AppData\Local\RStudio` and was able to find history there and recover the file from there (as luckily I run it entirely) – Symbolize