[R] = vs. ==?

Pedro de Barros pbarros at ualg.pt
Tue Apr 15 15:10:08 CEST 2008


= means assignment (like a=2, may be used instead of a <- 2, although 
I prefer to always use <-); It is also used to pass values to 
arguments in named argument lists, or to set default argument values).

== is the boolean (logical) operator for testing whether two values are equal
e.g. a <- 2
b <- 2

then a == b is TRUE

Hope this helps,
At 13:28 2008/04/15, Linn wrote:

>Could anyone please explain to me the difference between the = and the ==?
>I'm quite new to R and I've tried to find out but didn't get any wiser...
>View this message in context: 
>Sent from the R help mailing list archive at Nabble.com.
>R-help at r-project.org mailing list
>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