R Studio can't open and save .R files

Hi all,

I have a weird problem. I have written some scripts in R using R-Studio and saved them as .R files. However, when I try to open the .R file with R-Studio I only get an empty sheet without any code. When opening the .R file with an Edtior you can see the code. I have attached a screenshot where you can see the problem. Do you have any idea, why this is happening and how I can avoid this? I'd appreciate every comment.

Update: I also found out, that RStudio most often does not save the code in the .R file. Sometimes it works and the code is saved in the .R file and sometimes it does not save anything and the resulting .R file has a size of 0 in the file explorer and when opening it any editor there is no content.

This is really strange. You you have any idea what it causing the problem? I forgot to mentione that I use R Studio by using Anaconda


I your sure that the file open on Rstudio is the same you see on your directory? Can you check the current working directory on rstudio (getwd())? I know that Anaconda install Rstudio in his directory (Something like Anaconda3/) on a special env.

I also see that the file you are talking about was not modify since 03/2020 (~1Year) . It's weird if you change the file recently.

I think it is a directory problem.

Thanks Rodgrigue for your answer,

Bascially I think it is an Anaconda problem because I have been experiencing many many problems with Anaconda (especially with R) and I am generally questioning the software quality of Anaconda. This is why I choose to install R and RStudio without Anaconda and now everything seems to be okay.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.