[R] recommendations on use of -> operator
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Mar 18 13:00:31 CET 2010
-> is usually only used when you suddenly remember you wanted to keep
result of a computation, especially in the days before command-line
editors were universal.
fn(a,b) ... oh I'd better keep that ... -> z
On Thu, 18 Mar 2010, 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?
>
> 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list