Bug 14746 - R.app script editor snafu in Mac OS X10.5
Summary: R.app script editor snafu in Mac OS X10.5
Alias: None
Product: R
Classification: Unclassified
Component: Mac GUI / Mac specific (show other bugs)
Version: R 2.14.0
Hardware: ix86 (32-bit) Mac OS X v10.5
: P5 minor
Assignee: Simon Urbanek
Depends on:
Reported: 2011-12-05 05:27 UTC by John Kittelson
Modified: 2013-11-18 10:14 UTC (History)
1 user (show)

See Also:

R-script file from built-in editor that shows bug (58 bytes, text/plain)
2011-12-06 01:15 UTC, John Kittelson

Note You need to log in before you can comment on or make changes to this bug.
Description John Kittelson 2011-12-05 05:27:24 UTC
# Executing of the following lines together using apple-enter from the R code file (using the built-in editor) gives the following result:

x <- 3
x <- x*2
[1] 6

# Executing the above lines separately in sequence (i.e., not together) seems to execute the second line twice (thus multiplying by 4 instead of 2):

x <- 3

x <- x*2
[1] 12

# NOTES: friend running later mac OS did not have the problem. The problem does not seem to occur with the "=" assignment.

#*** version information

> version
platform       i386-apple-darwin9.8.0       
arch           i386                         
os             darwin9.8.0                  
system         i386, darwin9.8.0            
major          2                            
minor          14.0                         
year           2011                         
month          10                           
day            31                           
svn rev        57496                        
language       R                            
version.string R version 2.14.0 (2011-10-31)
Comment 1 Brian Ripley 2011-12-05 14:24:15 UTC
How can this be 'critical': the R.app script editor is not needed to run R?
Comment 2 Simon Urbanek 2011-12-05 17:00:39 UTC
I cannot reproduce it:

> x <- 3
> x <- x*2
> x
[1] 6
> x <- 3
> x <- x*2
> x
[1] 6
> x <- 3
> x <- x*2
> x
[1] 6

The result is the same regardless how the lines are submitted (en-block, one by one [<cmd><enter>, <down>, <cmd><enter>, ...]).

> system("uname -a")
Darwin hagal.research.att.com 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386

Can you paste the *exact* result from the GUI? Obviously you have typed the results by hand ...
Thanks, S
Comment 3 Brian Ripley 2011-12-05 17:13:35 UTC
Nor can I reproduce it on Leopard.
Comment 4 John Kittelson 2011-12-05 21:31:10 UTC
Still a problem for me...

Here is a different example along with a cut and paste result from the GUI:

# the following are entered en-block in the default editor and executed by apple-return:
x <- 3
x <- x + 2
# I then repeated above 1 line at a time

# Cut and pasted from GUI for both iterations:
> x <- 3
> x <- x + 2
> x
[1] 5
> x <- 3
> x <- x + 2
> x
[1] 7
Comment 5 Simon Urbanek 2011-12-05 22:47:43 UTC
Same result - works just fine.
So I have only two ideas:
a) can you save the script and attach it here? (maybe gzip it first to make sure it is not modified along the way)
b) can you check that you don't have any haxxies installed? They usually interfere with the input and get loaded into all applications changing their behavior - check ~/Library/Input*
Comment 6 John Kittelson 2011-12-06 01:15:21 UTC
Created attachment 1254 [details]
R-script file from built-in editor that shows bug

I do not have any haxies that I know of, the directory /Library/input* is empty

The attached file shows the behavior when executed line-by-line. (Each line appears to be executed twice.)
This same problem occurs on both of my computers (both with mac OS x 5.8).
The same problem also occurs when I cut/paste from this file into the R-GUI.
It does not occur if I cut/paste from this file when I open it in textedit.