[R] What to use for assignment, " = " or " <- "?
bolker at ufl.edu
Sun Apr 6 16:35:11 CEST 2008
<Bill.Venables <at> csiro.au> writes:
> I've noticed an increasing tendency for people to use '=' rather than
> the older '<-' symbol. When '=' became available as an assignment
> operator in S-PLUS in the late '90s my first reaction was to switch to
> it as well. Brian Ripley warned me that it was not a good idea. As
> usual he was right, but it took a couple of pretty serious
> finger-burning episodes before I came fully around to his view.
> I suspect the push towards using '=' instead of '<-' has two main
> 1. the world is full of lazy typists
> 2. right now there seems to be a big influx of Matlab people into R, and
> it makes them feel more at home.
> Neither of these is much of a reason, I reckon.
It may not be a good reason, but the reason I usually
teach "=" rather than "<-" to my students is that they are
usually learning scripting/programming for the very first
time, and the "=" syntax for assignment (which as I recall
was called "gozzinta", for "goes into", in the FORTRAN coloring
book) seems natural to most people (even though it's
logically quite different). They are so overwhelmed by
learning new things that I don't want to add one more.
(This is admittedly a judgment call.)
More information about the R-help