Re: [R] questions on some operators in R

From: Erik Iverson <eriki_at_ccbr.umn.edu>
Date: Fri, 18 Jun 2010 16:45:44 -0500

Horace Tso wrote:
> You still couldn't sway me into the <- camp. '=' is better for yet
> two more reasons,
>
> 1. it requires one keystroke, rather than two,
>
> 2. to type '<', one has to hold Shift then the ',' key, so it's a
> total of three strokes all together.

This is a valid point.

You can, however, configure your editor to automatically do this sort of thing. For example, ESS for Emacs has 'ess-toggle-underscore', which upon typing an underscore, will insert ' <- ' by default.

So compare:

x = y at 5 keystrokes using no keyboard shortcuts

vs.

x <- y at 4 keystrokes using the ESS default (counting '_' as 2 keystrokes)

I prefer binding M-= rather than underscore to invoke this behavior, still two keystrokes, but more natural to me.

> In a typical script, you have hundreds of assignment statements.
> Those extra keystroke translate into quite a bit more wear on your
> fingers.

In one R package I wrote here at work, I have:

'<-' assignments / total characters
956 / 96387
[1] 0.00991835

So, without keyboard shortcuts, I could have saved about 1000 characters over the development time of this package. Compare to this email, which contains over 1100 characters. :)



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 18 Jun 2010 - 21:49:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 22:20:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive