Search code examples
rrstudio

What is causing my R script text to disappear?


I've encountered a very bizarre problem with my R scripts. I had a bunch saved in a folder, and after reinstalling R (which was itself having some issues), the rather large scripts I had can easily open in R, but appear to have no text on them (this is despite it clearly labeled as an R document in the folder and being 26kb). Yet when I upload my scripts in a message on Slack, it appears perfectly fine.

Here is what my R script looks like presently: enter image description here

And this is what it should look like: enter image description here

I'm thinking it has something to do with the way R is reading the text in the script, but I couldn't find any answers online that were helpful. I would greatly appreciate any advice, as I dont' want to have to recreate all of these using Slack of all things...


Solution

  • I figured it out with some tinkering and it was a rather simple fix that mirrored what I thought the issue was. Apparently my RStudio program was set to read the text in CP936 format. I set it to system default:

    enter image description here

    And viola! My text is now back!

    enter image description here