Content of .R file deleted - not the file, but the content




I just had a rather unfortunate experience and i'm not entirely sure whether its a R or Rstudio issue.

On my plain old local disk running Windows10, Rstudio 1.1.456 and R 3.5.1 - I was creating a gif using the magick package when I got an error saying something along the lines of 'file not reachable' and then when I closed Rstudio the .R file inside my project got completely wiped of all code and I now have an empty .R file even though the file itself still exists inside my project directory. I'm absolutely positive that I did not delete or move the file and somehow the troubles seemed to start when I tried to save the gif I created with a .mp4 extension.

I couldn't restore windows to an earlier point so I guess my chances of getting my code back are slim to none.

But do anyone have a clue what went wrong? and perhaps suggestions for getting my code back?



wow, that's really wild. I have not run into anything like this, but debugging is going to be hard because, by definition, you can't post the code that caused the problem. Which makes it hard to reproduce.

Are you running any background file monitoring software like OneDrive or GoogleDrive? Sometimes they produce file history that allows rolling back changes.


I had exactly the same problem. I'm to R and Rstudio, so my code is extremely simple, but sometimes, it justs kind of disappear !
I still have the file, but it's completly clear of my code.
I have also Rstudio version 1.1.456 and R 3.5.1. I tried with anaconda distribution, and experienced the same issue...
So I edit the file with a text editor (Notepad++), they were blank. I retyped my code in that editor, and open it in Rstudio. It works for few minutes, and go blank again !
What is extremely strange is that I kept open the file with my text editor, I still have the code, but in Rstudio, it's blank ! I closed Rstudio, restart it, re-open the file, and it's blank !!
Rstudio just won't read that R file anymore...


Sorry for the trouble!

A diagnostics report could potentially be helpful -- if we're luck, some kind of warning / error may have been logged at the time when the file contents were lost.

Are you using any 3rd-party cloud synchronization services (e.g. Dropbox)? Can you think of anything that might make your environment unique relative to a typical at-home desktop environment?