Skip to content
Prev 39391 / 63424 Next

unique.matrix issue [Was: Anomaly with unique and match]

match() is a red herring here -- it is really a very specific thing that has to do with the fact that you're running unique() on a matrix. Also it's much easier to reproduce:
[1] 1 1
[1] "0x1p+0"               "0x1.0000000000001p+0"
[1] 1 1
[1] "0x1p+0"               "0x1.0000000000001p+0"
[,1]
[1,]    1
 
and this comes from the fact that unique.matrix uses string representation since it has to take into account all values of a row/column so it pastes all values into one string, but for the two numbers that is the same:
[1] "1" "1"

Cheers,
Simon
On Mar 9, 2011, at 9:48 AM, Terry Therneau wrote: