Re: [R] = vs. ==?

From: Gad Abraham <gabraham_at_csse.unimelb.edu.au>
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 http://cran.r-project.org/doc/manuals/R-intro.html

-- 
Gad Abraham
Dept. CSSE and NICTA
The University of Melbourne
Parkville 3010, Victoria, Australia
email: gabraham_at_csse.unimelb.edu.au
web: http://www.csse.unimelb.edu.au/~gabraham

______________________________________________
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.
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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive