Accidentally deleted entire r code and now it's gone forever?

I don't know how but I think I accidentally deleted my entire code and couldn't ctrl+z. Now my file I worked hard on is saved as completely blank. Is there anyway to get a history of and somehow recover my code?

Try history(). It may or may not work depending on your system and how your R installation was configured. In *nix you can also look at the .RHistory file in your home directory

Hi, the first thing you should do is stop writing new files to your files and check your history. If you still can not find your code, you can try data recovery tool, although it's not convenient, but it's a good choice. You can try the Bitwar data recovery, which is free to use compare with other programs. Hop you can get back your code soon.