Re: [R] = vs. ==?

From: Gad Abraham <>
Date: Wed, 16 Apr 2008 08:58:22 +1000

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

"=" is the assignment operator as in

 > x = 3
 > x
[1] 3

(but use the "<-" operator instead, see a post by Bill Venables a few days ago called ``What to use for assignment, " = " or " <- "?'')

whereas "==" is the binary operator for testing equality, as in

 > x == 3
[1] TRUE Have a look at any introductory R book or at the R intro at

Gad Abraham
Dept. CSSE and NICTA
The University of Melbourne
Parkville 3010, Victoria, Australia

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 16 Apr 2008 - 01:06:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 02:30:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive