[R] advice/opinion on "<-" vs "=" in teaching R

S Ellison S.Ellison at lgc.co.uk
Mon Jan 18 11:54:20 CET 2010



>>> Thomas Lumley <tlumley at u.washington.edu> 15/01/2010 16:07 >>>
>> Which should I use or does it matter, please?
>
>I would say to use = if you are teaching people familiar with C or
Java, and to use <- otherwise.

Nothing like an option to induce polarisation!

'=' is used in at least two contexts in R, one of which does not imply
formal assignment. 

'<-' (and the left-to-right version '->') only mean formal assignment.

It is nearly always better in teaching programming languages to teach
the unambiguous/'always safe' form first or only. 

Anyone who learns multiple languages should be able to cope with such a
small change in operator, and the rather important difference between
assignment, name/value pairing and logical equals that R makes explicit
is actually a useful indicator that they are genuinely different
things.

Steve Ellison



*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list