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)
Oh, why not just go one step further, and redefine the == operator!
"==" <- function(x,y){equal.enough(x,y)}
before: > (.1+.2)==.3 [1] FALSE
after: > (.1+.2)==.3 [1] TRUE
This requires a slight modification to equal.enough, which I will not list here, so that people dont _actually_ do this. It just ensures that equal.enough doesn't go all infinitely recursive on us.
Next time on useless R tips: 1 + 1 = 3
Barry
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help