[R]  erratic behavior of match()? >Is this a consequence of machine error or something else?
>Could this be overcome? (It works correctly when integers are used in
>the sequences as well as in many other circumstances)

The usual solution for testing a==b with floating-point round-off error is 
abs(a-b) X1=seq(0,1,len=11)
> X2=seq(0,1,len=101)
> match(X1,X2)
  [1]   1  11  21  NA  41  51  NA  71  81  91 101
> match(round(X1,2),round(X2,2))
  [1]   1  11  21  31  41  51  61  71  81  91 101

In the following case, X2 does not round "exactly" but 7-digit accuracy 
seems fine.

> X2=seq(0,1,len=31)
> match(X1,X2)
  [1]  1  4  7 NA 13 16 NA NA 25 28 31
> match(round(X1,7),round(X2,7))
  [1]  1  4  7 10 13 16 19 22 25 28 31

______________________________________________
R-help@stat.math.ethz.ch 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.

