Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R not responding request to interrupt stop process

Tags:

r

rstudio

Every now and then I have to run a function that takes a lot of time and I need to interrupt the processing before it's complete. To do so, I click on the red sign of "stop" at the top of the console in Rstudio, which quite often returns this message below:

R is not responding to your request to interrupt processing so to stop the current operation you may need to terminate R entirely.

Terminating R will cause your R session to immediately abort. Active computations will be interrupted and unsaved source file changes and workspace objects will be discarded.

Do you want to terminate R now?

The problem is that I click "No" and then Rstudios seems to freeze completely. I would like to know if others face a similar issue and if there is any way to get around this.

Is there a way to stop a process in Rstudio quickly without loosing the objects in the workspace?

like image 741
rafa.pereira Avatar asked Mar 31 '17 20:03

rafa.pereira


People also ask

How do you unfreeze in R?

If you've accidentally frozen R by typing ctrl-s, you can unfreeze it by typing ctrl-q.

How do I stop a process in RStudio?

The shortcut to interrupt a running process in R depends on the R software and the operating system you are using. However, if you are using RStudio on a Windows computer, you can usually use Esc to stop a currently executing R script. Then, we can press Esc to interrupt the loop.

How do you force quit in R?

Make sure your cursor is in the console and try to re-execute previous commands. To quit R you can either use the RStudio > Quit pull-down menu command or execute ⌘ + Q (OS X) or ctrl + Q (PC).


2 Answers

Unfortunately, RStudio is currently not able to interrupt R in a couple situations:

  1. R is executing an external program (e.g. you cannot interrupt system("sleep 10")),

  2. R is executing (for example) a C / C++ library call that doesn't provide R an opportunity to check for interrupts.

In such a case, the only option is to forcefully kill the R process -- hopefully this is something that could change in a future iteration of RStudio.


EDIT: RStudio v1.2 should now better handle interrupts in many of these contexts.

like image 117
Kevin Ushey Avatar answered Oct 03 '22 20:10

Kevin Ushey


This could happen when R is not working within R and is invoking an external library call. The only option is to close the project window. Fortunately, unsaved changes including objects are retained on opening RStudio again.

like image 44
UDIT GUPTA Avatar answered Oct 03 '22 21:10

UDIT GUPTA