0

This morning I got up and opened one of my .R Files only to see that over 75% of my code was missing. I have absolutely no idea what happened. I've checked history() to see that nothing appears. I need to be able to get the code back. I have all of the objects saved in a .RData file but when I load() it I can only access the objects not the code. I can't seem to find any version history on the file. Do you guys know of any way to get the code back? Really appreciate the help on this.

Lcsballer1
  • 97
  • 8
  • 1
    try https://stackoverflow.com/questions/35223435/how-to-get-unsaved-script-tabs – Nad Pat Sep 05 '21 at 14:10
  • 1
    If you're talking about RStudio, `history()` opens in the history tab rather than the console. You could also find it in the working directoru of your project, it's called `.Rhistory`. It's different though from your corrupt `.R` file, but probably helps you to restore your code. Else if, check @NadPat's link, else begin asap to write the code new, might be a good exercise for you. Also check your global settings for automated saving. – jay.sf Sep 05 '21 at 14:14
  • I ended up finding it using @Nad Pat suggestion. Thank you so much guys. This is a MASSIVE relief. – Lcsballer1 Sep 05 '21 at 14:28
  • 2
    Does this answer your question? [How to get unsaved script tabs](https://stackoverflow.com/questions/35223435/how-to-get-unsaved-script-tabs) – Nad Pat Sep 05 '21 at 14:52
  • Yes it does @Nad Pat, if you'll submit as answer I'll accept. Thanks – Lcsballer1 Sep 05 '21 at 15:12
  • 1
    Question is closed :) – Nad Pat Sep 05 '21 at 16:19

0 Answers0