ending "+" prompt in R

TMin picture TMin · Sep 14, 2013 · Viewed 93.2k times · Source

I'm fairly new to R and I made a type-o while entering some code and now instead of getting the ">" prompt I get a "+" prompt. I appear to be stuck in some kind of function that is looking for input, but I can't seem to get out of it. I figure that there must be a better way to fix this problem then closing R and rerunning my script but I haven't been able to find anything on google (likely because I don't know the right search terms).

Thanks for your help, sorry it's a trivial question

The code I entered was as follows:

> fit = lm(x~`y)
+ fit = lm(x~y)
+ fit
+ summary(fit)
+ 
+ 
+ end
+ ;
+ break
+ )
+ 
+ 
+ 
+ 
    
    
+ 
    
+ quit()
+ 
+ quit
+ break()
+ abline(b0hat,b1hat)
+ return(null)
+ 

Answer

Konrad Rudolph picture Konrad Rudolph · Sep 14, 2013

It depends on how you’re running R.

In the terminal, the “normal” way is Control+C – the “cancel” key combination.

In the graphical R application and in RStudio, it’s Escape.