Hello, You assigned 53 to c, not cc. Also, take a look at this:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f On Tue, Dec 9, 2008 at 9:36 PM, Renny Li <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to compare two values using "==" operand, please take a look of > the following example (I copied ALL what I did here without deleting any line) > >> bb<-1 >> cc<-50 >> cc==abs(bb+52) > [1] FALSE >> C<-53 >> C<-53 >> c<-53 >> cc==abs(bb+52) > [1] FALSE > > I am expecting to see a TRUE here. Then I tried another way, > >> abs(1+52) > [1] 53 >> cc==abs(1+52) > [1] FALSE > > Why it is FALSE. Then I tried > > >> d<-abs(b+52) > Error: object "b" not found >> d<-abs(bb+52) >> d > [1] 53 >> c==d > [1] TRUE > > Now it is TRUE, but a wired thing is as following, >> c==abs(bb+52) > [1] TRUE > > The coding "c==abs(bb+52)" is just the same from the 3line in the top, why 2 > different results? HOWEVER, it is not repeatable, I am glad I did not close > the window. > > Also, >> c<-0.5-0.1 >> n<-0.6-0.2 >> n==c > [1] FALSE > > So, is "==" comparing formula or result? > > Thanks, > Renny > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@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. > > ______________________________________________ R-help@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.