On Wed, Mar 11, 2009 at 7:18 AM, Sean Zhang <seane...@gmail.com> wrote:
> Dear R-helpers:
>
> I have a question related to <- and =.
>
> I saw very experienced R programmers use = rather than <- quite
> consistently.
> 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.
>
> -Sean

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
true.

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:

http://blog.revolution-computing.com/2008/12/use-equals-or-arrow-for-assignment.html

# David Smith

-- 
David M Smith <da...@revolution-computing.com>
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (Seattle, USA)

______________________________________________
R-help@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.

Reply via email to