R Markdown will not run lines of code or code chunks - Outline with Solution

Hello R Studio community!

I wanted to share a situation that happened to me yesterday as when I attempted to self help on this topic I was unable to find any relevant occurrences. Hopefully this will help someone in the future!

Relevant Details

  • Computer: MacBook Pro 2 Ghz Quad Core Intel Core i5 with 16GB memory on Sequoia 15.1.1
  • R Version: 4.4.2
  • R Studio Version: 2024.12.0 Build 467

Event Description
I was working with a data set where one of the questions that a survey respondent could answer had nine options in a multiselect (the user could answer one, multiple or all options). The survey platform exported a .SAV file where each response was it's own column: q1_r1, q1_r2, q1_r3 etc etc. Under the column would be a 0 for did not select and a 1 for select.

I replaced each of the ones with a three letter code, and my client wanted to know what were the most commonly selected combinations. For example, what is the n count for R1;R2 vs R2;R3. Since I was using tidyverse to transforms the ones into the relevant responses, I decided to stay in tidyverse and use the "unite()" function to combine the responses together.

I used command+return to run the line and then nothing happened.

Troubleshooting
I selected the code using the mouse and used the "run" command at the top of the markdown window. Nothing happened.

I could execute code in console, but I was unable to execute any code in the R markdown window. I opened a new rmarkdown file and again, the same issue. No highlighted code chunk or line would execute. Nothing would happen in the history window or console.

I opened an R script and put in a = 1, b = 1, c = a + b, print(c) and nothing happened. Copy and pasting to console worked.

I closed the project and opened a new project. Same issue, nothing worked.

At this point I turned to Google and did multiple searches on R not allowing you to execute code or code chunks. I found one stackoverflow link that talked about a similar issue but the presented solution didn't work in MacOS.

I restarted the computer and tried the above steps. Nothing worked.

I uninstalled R and R Studio and re-installed. Reopened the project and nothing happened. I tried the other steps above. Nothing worked.

Solution
What finally managed to make this work was deleting the project itself. Once I deleted the project I was able to open R Studio and run scripts and R markdown files again. I am unsure why this is the case, but it has managed to fix the underlying issue. I have not yet attempted to replicate the problem as I am now behind at work and need to catch up, but I am hoping that this will help someone in the future.

I am aware that I am not an expert on coding or programming. My training and experience is primarily in the social sciences and I used SPSS for most of my career. I switched to R as it "felt" right and my employer at the time (this was many years ago) was not willing to pay for SPSS licenses. I was given the choice between Python and R and was able to make far more progress with R on my projects than I was with Python. As a result, I am sure there might be better methods to have figured out what had happened and fixed it, but I did get R Studio working again and am able to continue working on my projects. If there are better solutions or trouble shooting steps, please share them below!

Thank you for your time!

This topic was automatically closed 90 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.