On 16/07/2010 10:57 AM, linda.s wrote:> Hi.
> I am a beginner. What is the difference between:
> x<-2
> and
> x=2
>
It depends on the context. "x <- 2" always assigns the value 2 to
the
variable named x. Typed as an isolated command, that's what "x =
2"
does too. However, when used as an argument to a function, e.g. f(x =
2), it associates the value 2 to the *argument* matched by x in the
function call. This is occasionally confusing, so many people recommend
that you always use "x <- 2" when you mean to do an assignment, and
reserve the use of "=" for function arguments.
Duncan Murdoch