Somehow two of my .R file have been converted from text to symbols and gibberish (sample below). I was hoping that someone would be able to tell me how to convert them back to text. One script has been totally converted to mystery text, while the other became corrupted about halfway through.
I have been building these scripts for quite some time and routinely save updates using R studio's save option. Both of these files are quite long and contain all the assumption checking for the models I am building for my thesis. It would be amazing if I did not have to rebuild them. I do not encode my script or modify the default setting in any way.
I believe that these two scripts became corrupted when the files were opened automatically the last time I worked in R Studio. I opened the program to work on another script. While working I dropped something on my keyboard causing that code to change to the same mixture of odd text and symbols. I was able to undo this mistake using ctrl+Z and save that script as an R file using the standard commands. Being that I was not working in either of corrupted scripts I did not check or save them before I exited the program.
I have done some searching and found a couple of other instances where this has happened but there was no mention of how they resolved the issue. I have played around with changing the encoding and they one thing this achieves is changing some of the letters to what I believe is Mandarin. Any help would be much appreciated!
That's pretty rough, Lydia! Do you have any backups you can fall back on?
Yeah things are not looking to promising. Funny thing is I deleted my old back up and replaced it with the corrupted file right before I found the issue. Being that the back up is quite large it permanently deleted it from my computer. So the long and short is nope no back.
If you tested the parts in the console as you wrote the script, the command history may be the place to look.
Also, hindsight 20/20, but version control is great at preventing these kinds of problems.