Skip to content
Prev 206390 / 398506 Next

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

On 15-Jan-10 09:29:16, Deepayan Sarkar wrote:
Thanks for spelling out "braced list", Deepayan.
And I have to agree with you about the readability of "<-".

Indeed, as summary advice to Erin, I wouild say use "<-" except
in the specific context of assigning values to named parameters
in functions, to named elements of lists, and the like (where
use of "=" is mandatory anyway, or you won't get the desired
effect -- see below).

  list(x<-1.234,y<-2.345)
  # [[1]]
  # [1] 1.234
  # [[2]]
  # [1] 2.345

  list(x=1.234,y=2.345)
  # $x
  # [1] 1.234
  # $y
  # [1] 2.345

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 15-Jan-10                                       Time: 10:01:55
------------------------------ XFMail ------------------------------