RE: [R] Numbers that look equal, should be equal,but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Simon Fear
Fear Cc: [EMAIL PROTECTED] Subject: Re: [R] Numbers that look equal, should be equal, but if() doesn'tsee as equal (repost with code included) Next time on useless R tips: 1 + 1 = 3 Barry Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 69 Fax: +44 (0) 1379 65

RE: [R] Numbers that look equal, should be equal,but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Simon Fear
Try the following function (the name is supposed to be a joke, by the way), which will also do the right thing with NAs and characters. Use it as if(equal.enough(x,y)) rather than if(x==y), e.g. > equal.enough(0.1+0.2, 0.3) [1] TRUE My default of 15 significant figures may be overkill in many app

Re: [R] Numbers that look equal, should be equal, but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Prof Brian Ripley
On Wed, 28 May 2003, Paul Lemmens wrote: > Hoi Thomas, > > --On woensdag 28 mei 2003 7:16 -0700 Thomas Lumley > <[EMAIL PROTECTED]> wrote: > > > On Wed, 28 May 2003, Paul Lemmens wrote: > > > >> Hi! > >> > >> Apologies for sending the mail without any code. Apparently somewhere > >> along the w

Re: [R] Numbers that look equal, should be equal, but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Paul Lemmens
Hoi Thomas, --On woensdag 28 mei 2003 7:16 -0700 Thomas Lumley <[EMAIL PROTECTED]> wrote: On Wed, 28 May 2003, Paul Lemmens wrote: Hi! Apologies for sending the mail without any code. Apparently somewhere along the way the .R attachments got filtered out. I have included the code below as clea

Re: [R] Numbers that look equal, should be equal, but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Thomas Lumley
On Wed, 28 May 2003, Paul Lemmens wrote: > Hi! > > Apologies for sending the mail without any code. Apparently somewhere along > the way the .R attachments got filtered out. I have included the code below > as clean as possible. My original mail is below the code. I still think you need not to be