Rolf Turner is right on the money about not mixing-up '=' and '<-'

Though this 'gotcha' will always a threat while  '<-'  is the assignment 
operator.

The old Algol60 syntax of ':=' was less error-prone, but I guess '<-' is too 
firmly bedded-in to ever change.

Meanwhile, spaces around the assignment operator gives less error-prone and 
more readable code.

cheers  Bob Kinley  

_____________________________________________

-----Original Message-----
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rolf Turner
Sent: 02 February 2015 11:58
To: Steve Taylor; r-h...@stat.math.ethz.ch
Subject: Re: [R] the less-than-minus gotcha


On 02/02/15 14:26, Steve Taylor wrote:

> All the more reason to use = instead of <-

Couldn't agree less, Steve. The "<-" should be used for assignment. The "=" 
sign should be reserved for handling function arguments in the "name=value" 
form.  Doing anything else invites confusion and occasionally chaos.

Lots of examples have been given in the past involving syntax of the form foo(x 
= y) and foo(x <- y).

cheers,

Rolf

--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
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.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to