[R] recommendations on use of -> operator
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Mar 18 12:52:19 CET 2010
On 18/03/2010 7:08 AM, Dan Kelley wrote:
> I have never used -> but I noticed at
>
> http://github.com/jiho/r-utils/blob/master/beamer_colors.R
>
> that some people do. In fact, the above-named code has a sort of elegance about it (except for the use of "=" for assignment...). To my eye, -> calls to mind a type of assignment that is meant to stand out. For example, perhaps it would make sense to use -> to assign to things that are not expected to vary through the rest of the code block.
>
> Q1: is there a convention, informal or otherwise, on when to use the -> operator?
My recommendation would be "never". It's rarely used and unnecessary,
so you'll just confuse people. It also looks identical to the ->
operator in C for pointing to a member of a structure, another cause for
confusion for some people.
Duncan Murdoch
>
> Q2: if there is no convention, but if people think a convention might help, what would that convention be?
>
> Dan Kelley, PhD
> Professor and Graduate Coordinator
> Dept. Oceanography, Dalhousie University, Halifax NS B3H 4J1
> kelley.dan at gmail.com (1-minute path on US server) or Dan.Kelley at Dal.Ca (2-hour path on Cdn server)
> Phone 902 494 1694; Fax 902 494 3877
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
More information about the R-help
mailing list