Anthony Westerling
2004-Dec-06 08:33 UTC
[R] Cocoa GUI: pasting in R Console yields syntax error
I've recently upgraded to R-2.0.1 on a Mac running OS X 10.3+ I am using the new Cocoa-based GUI. Everything was working well for a while. In the middle of an R session, I started "suddenly" to have a problem where code copied from an open editor window and pasted into the R Console gives a syntax error. It doesn't matter what the code is. If the same exact text is typed into the console directly, I get no errors. I tried quitting the R session and restarting. The problem did not go away. I tried using a different editor, instead of the built-in editor. After opening the file with my R code in it in AlphaX instead of the built-in editor, I could see that the text typed most recently ( ie, since the problem started) had a character that looked like an open square or box at the start of most lines. I deleted these and can't see any other extraneous symbols in AlphaX. However, I still get syntax errors when trying to paste code that was originally typed in using the built-in editor. If I retype the same thing in the same file using AlphaX, one line below the original, then copy and paste into the R console, it executes without generating syntax errors. So, it looks like something odd is going on with the built-in editor? Anthony Westerling
Anthony I faced the same problem and it took me some time to spot the origin: I have no clue where it can come from!( I suspect this happened when I moved from 1.9.0 to 2.0.0, OS X 1.3...). I know that the built in R editor is very handy: what I do is a "more myfile.r" on the terminal to check if there are weird characters and then delete then directly with the R editor. Not very efficient I reckon: OS X gurus may have another solution! David On 6 Dec 2004, at 08:33, Anthony Westerling wrote:> I've recently upgraded to R-2.0.1 on a Mac running OS X 10.3+ > > I am using the new Cocoa-based GUI. Everything was working well for a > while. In the middle of an R session, I started "suddenly" to have a > problem where code copied from an open editor window and pasted into > the R Console gives a syntax error. It doesn't matter what the code > is. If the same exact text is typed into the console directly, I get > no errors. > > I tried quitting the R session and restarting. The problem did not go > away. > > I tried using a different editor, instead of the built-in editor. > After opening the file with my R code in it in AlphaX instead of the > built-in editor, I could see that the text typed most recently ( ie, > since the problem started) had a character that looked like an open > square or box at the start of most lines. I deleted these and can't > see any other extraneous symbols in AlphaX. However, I still get > syntax errors when trying to paste code that was originally typed in > using the built-in editor. If I retype the same thing in the same > file using AlphaX, one line below the original, then copy and paste > into the R console, it executes without generating syntax errors. > > So, it looks like something odd is going on with the built-in editor? > > Anthony Westerling > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >