[R] Is there any difference between <- and =
David M Smith
david at revolution-computing.com
Wed Mar 11 16:56:50 CET 2009
On Wed, Mar 11, 2009 at 7:18 AM, Sean Zhang <seanecon at gmail.com> wrote:
> Dear R-helpers:
> I have a question related to <- and =.
> I saw very experienced R programmers use = rather than <- quite
> However, I heard from others that do not use = but always stick to <- when
> assigning valuese.
> I personally like = because I was using Matabl, But, would like to receive
> expert opinion to avoid potential trouble.
> Many thanks in advance.
The short answer is that <- is used for assignment, and = is used to
associate function arguments with their values. You can use = instead
of <- for assignment too (in most contexts), but the converse isn't
I've provided more detail about when you can and can't exchange the
two operators (and some of the history about the operators themselves)
in this blog post:
# David Smith
David M Smith <david at revolution-computing.com>
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (Seattle, USA)
More information about the R-help