Hello,
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...