I'm facing a serious issue with one of my R scripts and desperately need help recovering its content. Here's what happened:
Problem Description
After force rebooting my Windows PC, one critical R script (.R file) shows blank/empty content when opened in RStudio
However, Windows Explorer still shows the file size as 112KB (original size)
The file appears intact, but content is missing when opened
What I've Tried
✓ Attempted to reopen with different encodings (UTF-8, ANSI, etc.)
✓ Verified file isn't hidden or read-only
✓ Tried opening in Notepad++/VS Code - same empty result
I also tried updating RStudio to the latest version (2024.12.1+563) and R to version 4.5.0, but the issue still persists. Does any one can help me? Any other suggestions would be appreciated
Thank you for letting me know. Due to a GitHub account issue earlier, the file linked previously was temporarily unavailable. The issue has now been resolved, and the link should be accessible again. This file was saved in UTF-8 encoding in RStudio. Please try it once more, and let me know if you encounter any further problems.
The file does not appear to be UTF-8. It seems to be binary encoding. Most of it is zeros. If you source the file, nothing is added to the R environment. Sorry, this is a dead end.
Thank you for verifying this. I understand the file is corrupted, and I appreciate you taking the time to check it. I’ll reach out to the RStudio developers for further assistance. I really appreciate your time and help!
For future reference, there is a command line tool called strings (on linux, Mac). Running this even on a binary will return ASCII strings only from the binary. I don't know that would work here, but it is something to try if you still have the file.
Thanks for the suggestion about the strings command. I did try running strings on this binary file, but it returned no output.
After further analysis with xxd, I confirmed the file consists entirely of null bytes (0x00) from offset 0001bde0 to 0001be70. This explains why strings found nothing—there are no ASCII characters to extract. @sbanville-delfi@prubin