kl-higgins
kl-higgins

Reputation: 313

How to stop running a function when `Esc` isn't working in R?

Occasionally, I cannot access the Esc function in R (base R, not RStudio or other GUIs) to stop a function. R is running madly and a "Not responding" appears at the top of the menu bar (and everything is grayed out). I cannot access save script either.

Is there any way to force-stop without doing a force-quit and losing the script and working memory? If it is really stuck, is there any way to at least save the changes in the script or get a back-up copy?

My operating system is Windows 10, 64x.

UPDATE: I have recently discovered that running R via RStudio have the huge advantage that the script is autosaved and available on reopening RStudio so there is no loss of the changes to the script.

Upvotes: 0

Views: 1538

Answers (1)

moodymudskipper
moodymudskipper

Reputation: 47320

When you're stuck in a R loop, such as a for loop or an apply function you will be able to break it between the R calls, but if a call executed in C for instance takes time, then you're stuck and I don't believe there is any fix besides killing your session.

Upvotes: 1

Related Questions