[R] questions on some operators in R

Ivan Calandra ivan.calandra at uni-hamburg.de
Sat Jun 19 12:43:22 CEST 2010

Dear users,

Regarding the number of keystrokes, you guys should not forget that not 
everybody has a QWERTY keyboard, and therefore the number of strokes 
isn't the same for everybody. On an AZERTY keyboard (French), "<" is 
written without pressing SHIFT, as is "=". On a QWERTZ (German) "=" 
requires SHIFT while "<" does not! And there are also differences with 
Mac keyboards. So the argument of the number of keystrokes cannot be 
used choose "<" over "=" or vice versa.

I'm still quite new to R (I started a few months ago), and I've learned 
to use the "<-" assignment operator. I've directly found it intuitive 
since the arrow really shows the direction of assignment. I also 
had/have to train some students in my team and it looks to me that they 
are less confused when they use "<-" to assign and "=" for arguments 
within a function call. I think that when you learn, it's better to have 
different operators for different things.

The problem might be more for people who used other programming 
languages, where the assignment operators are different. But hey, there 
are also people who start learning with R!!

I'll stick to "<-"    :)


Le 6/19/2010 05:51, Greg Snow a écrit :
> That is really one reason stated in 2 pieces.
> If you really care more about saving characters or key strokes over clarity of expression then you should really be using APL (http://en.wikipedia.org/wiki/APL_(programming_language)) (though I think APL was part of the inspiration for<-, though when S was first created that was a single key stroke).  And if you are really concerned with wear on your fingers then you need to switch to the Dvorak keyboard (http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard), though<- is still 3 key presses, but you don't need to move your fingers as much (I actually switched to Dvorak to cure myself looking at my fingers, but now I can type much faster than I ever did on QWERTY).
> If you want to use "=", that is your decision, R-core decided to add it a while back (but I believe most if not all of them still use "<-").  I am more concerned that people understand the what are shortcuts and what they are shortcuts for and are aware of possible problems from using shortcuts rather than the more versatile tools that they are shortcuts for.  The longest distance between 2 points is a shortcut.

PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de


More information about the R-help mailing list