[R] = vs. ==?

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


Hi.

= 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,
Pedro
At 13:28 2008/04/15, Linn wrote:

>Hi
>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...
>
>Thanks
>--
>View this message in context: 
>http://www.nabble.com/%3D-vs.-%3D%3D--tp16700216p16700216.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>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.



More information about the R-help mailing list