R Crashed and I Lost My Code

Hello! I had a list and I accidentally compared a value to the whole list instead of the element in position i. I had something like this:

list0 <- c(1:10000)
list1 <- NULL
for (i in 1:length(list0))
list1[i] <- list0 > 1000

I should have written list0[i]. R started freaking out and throwing errors so I exited the window, and now when I reopen it, it gets stuck on the spinning beach ball and it won't load. This means I can't access my file. Can anyone please help?

Hi @jhirsch! Welcome!

Losing work is no fun at all :anguished:. In order to figure out the best way to help, can you clarify a few things?

  • Are you using R inside of RStudio? Or via another GUI (e.g., RGui.exe on windows, or R.app on Mac)?
  • Were you running code from a script file, or typing code directly into the console?

Yes of course, and thank you so much! I'm running R inside of RStudio Cloud, in a workspace. My code is in a script file. When I try to open that file, it freezes on me.

You can try relaunching the project. It's important to know that if it's successful, you will lose everything that was in your current R environment (objects created by your script or by commands you entered at the console), and any unsaved changes to open files (whatever was last saved should be OK though).

You get to Relaunch Project from the ... button next to the gear button at the top on the screen that loads endlessly.


If that doesn't work, you'll probably have to wait for a Cloud team member to respond in order to get more help from behind the scenes.


That fixed it! Thank you so so much, @jcblum. You're a miracle worker.

1 Like

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