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?