This is a bug that we have seen before and should have fixed for the next release. For now the workaround is to clear your state information by deleting your source_database directory.
On Windows 7, you can open an Explorer window to the see this file directory by typing the following command into Start -> Run:
%localappdata%\RStudio-Desktop
Note you can also safely delete the entire RStudio-Desktop directory if need be.
I deleted all the files about R I can find in my computer , the new Rstudio I installed works wel. I found the code is still in it, I don't know where it's saved ,but the environment is empty. By the way, my OS is windows-10, could it be the reason?