10

Say I enter the following commands into the console in Rstudio

x=seq(0,1e11, by=.01) plot(x,sin(x)) 

Clearly this is a very silly thing to do. But my question is how do you terminate this process? I couldn't find this answered anywhere.

Attempted solutions: pressing ctrl+q, pressing esc, going to session->interupt R, going to session->terminate R. Nothing seems to work. This seems to be specific to plotting, for example if you run a stupidly large loop, most of the above options seem to work as expected.

Ideally I'd like a solution that doesn't lose the R script I have been working on in the console (as I haven't saved it in awhile).

3
  • thanks, yep I had to kill it using the OS, and copying and pasting to a text editor is a truly pro tip! Although I agree I should save more often. Commented Dec 23, 2013 at 1:06
  • 1
    This is something you should bring up at the RStudio forums as a feature/bug report. Commented Dec 23, 2013 at 1:18
  • This is a big problem for me too, but I believe it's with R not Rstudio. However, some packages, like those made by RStudio authors (ggplot2, dplyr, etc), seem to break easier. Commented May 22, 2014 at 15:02

2 Answers 2

5

Re-posting my comment as an answer since it seems to have solved your problem.

  1. Save early, save often, cry less.
  2. Try clicking the little red stop icon above the console panel (unlikely to work if you've done all that you've done already).
  3. Try copy/pasting the script out to a text editor.
  4. Try killing just the rsession process through your OS (might leave RStudio open). The good news is that RStudio is often pretty smart about backing up working copies of scripts, so you might find it's still there even if you have to kill the whole program.
Sign up to request clarification or add additional context in comments.

Comments

0

Entering dev.null() in the console will kill any plots and I find it's less likely to crash RStudio than some of the options given by Ari B. Friedman.

That said, save early save often is always sound advice.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.