[R] How to quit R script & return to R prompt

David Winsemius dwinsemius at comcast.net
Thu Oct 25 17:35:42 CEST 2012


On Oct 25, 2012, at 6:00 AM, S Ellison wrote:

> 
> 
>> You typed a ` without closing it:
>> barplot(xtab(`profits`,data=Forbes2000)) 
>> 
>> anyway: pushing the escape button should also return you to 
>> the R-prompt (at least on a Windows platform)

Also on Macs.

> 
> But why is the OP using a backtick at all?

There was suggestive evidence in the rest of his post that his shift key is wonky and he did mean to type a tilde.

> It's not necessary in this instance (and in fact it's very rarely necessary at all unless you have used a syntactically invalid name with something silly like spaces in it). See ?Quotes for a little more detail on what ` does.
> 
> Also, xtab should possibly be xtabs, and the first argument to that is a one-sided formula, not a vector:
> 
>> library(HSAUR)
>> barplot(xtabs( ~ profits,data=Forbes2000)) 

Actually any unmatched single or double quote would have the same effect. Similar conundrums occur when Turing machines of any sort are reading input data where unmatched quotes result in huge missing gaps as line after line of perfectly useful data gets gathered up into one ungodly large single character element. (The human brain is thus demonstrated not to be a Turing machine.)


> 
> should work fine.
> 


David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list