[R] Unreadable code: was the underscore ("_") in variables

Pierre Kleiber pkleiber at honlab.nmfs.hawaii.edu
Tue Oct 3 20:45:12 CEST 2000


Patrick Connolly wrote:
> 
> According to Bill Venables:
> 
> |> If we follow your suggestion and give prominence to the fact that "_" is a
> |> synonym for "<-" then as sure as eggs some people will actually USE it!
> |> This is, in the opinion of many of us at least, a very BAD thing as it
> |> makes code just about unreadible.
> 
> It appears somewhat different from my perspective.
> 
> I got into the habit of using emacs S-mode early in my time with the S
> language.  Being a lazy typist, I found it convenient to use the
> parser to expand the assignments, add spaces and generally make
> readable any code I wished to use again (such as in functions).  To
> anyone looking over my shoulder it might look crude, but it works
> quickly and safely as I am concerned.
> 
> BTW: this no longer works using ESS as far as I can tell.  To a lazy
> typist this is a sad loss.  Has anyone found a way to return this
> functionality?
> 

I found (with the help of the ess hlp list and Hans Ehrbar) that if you
put the following in the .emacs file:

   (defun R-equals () (interactive) (insert " <- "))
   (global-set-key [?\C-=] 'R-equals)

then Ctrl-= will insert " <- ".  So lazy typists shold be able to
produce
readable R or S code (if they use ESS).

Cheers, Pierre


-- 
-----------------------------------------------------------------
Pierre Kleiber             Email: pkleiber at honlab.nmfs.hawaii.edu
Fishery Biologist                     Tel: 808 983-5399/737-7544
NOAA FISHERIES - Honolulu Laboratory         Fax: 808 983-2902
2570 Dole St., Honolulu, HI 96822-2396 
-----------------------------------------------------------------
 "God could have told Moses about galaxies and mitochondria and
  all.  But behold... It was good enough for government work."
-----------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list