Cannot see the code of various scripts in the Script window when open within R Studio

Thank you for posting! Here is an outline of an effective post:

Cannot see the code of various scripts in the Script window when open within R Studio

  • It is not the first time when it happened but I really don’t remember what I did to solve the issue
  • Have to finish an assignment for certification
  • I feel ridiculous to raise this issue but it feels that I have a magic scroll in my hand and I need to say some magic words to see what is actually written on the scroll.

Hello @cornel.lencar, thanks for posting. Can you include a screenshot of your view?

Hi Neale,

Sorry for all this.

It doesn’t show any code. And it is doing this on the old and the new laptop

Dear @cornel.lencar

To better assist you with your issue in the R community, it would be helpful if you could provide more information about the problem you are facing. A helpful outline might look like this:

Describe your issue

what are you trying to do?

What steps have you already taken to find an answer?

for example: I consulted the Epi R Handbook, etc.

Provide an example of your R code

code or script you are trying to execute

This outline might provide better context so the community can assist.

Based on the error message displayed in your RStudio console panel, there might be issues in lines 357 and 358 of your script. Console error messages usually indicate the specific location of a problem. Without more details on what you are trying to do, it can be challenging to offer the appropriate guidance.

If you are attempting to run the source() function to execute a file (such as ebola_analysis.R), please ensure that the script is correct because R will attempt to execute the code from the file and halt where it can’t proceed. If you only want to view the ebola_analysis.R file, you can simply open the script in RStudio to view the content.

Please feel free to provide more context and details about your issue, and we will be glad to help.

@cornel.lencar In the top-left pane there are three scripts open in tabs (Untitled, packages_to_install, and ebola_analysis). Currently, RStudio is showing the R script called “packages_to_install.R”, which appears to be empty (perhaps all of its code was deleted by accident?).

If you click to the right tab to view the script “ebola_analysis.R” do you see your code?

Agree with @BryanTegomoh that if you are running your ebola_analysis.R script by using the source() function then there will not be any output in the Console (bottom left pane) until an error is encountered. It is usually more informative to view the script and highlight/run code manually to troubleshoot the errors.

1 Like

Hi Neale,

Nothing was deleted. But it is weird. I open the Rproj associated with this course and three files open, the packages_to_install.R, ebola_analysis.r, and the ebola_sitrep.Rmd. For two of them, the scripts remains when I click on their respective tabs to look, but the one that I worked through the course, ebola_analysis.R, for a fraction of second I can see the script, after which it just disappears.

I will have to sit and to the covid assignment in one go and produce the word markdown document, because I am afraid that doing it in steps might get me in the same situation.

However, there is something happening with the settings that I am not aware of and it is not tenable for me on the long run to have this situation.