[R] max.col weirdness

Daryl Morris darylm at u.washington.edu
Thu May 28 22:46:55 CEST 2009


Hi,
I think there's some rounding issue with returning the max column.  
(running 2.9.0 on an Apple, but my buddy found it on his PC)

 > x <- matrix(c(1234.568,1234.569,1234.567),1)
 > max.col(x)
[1] 2
 > x <- matrix(c(12345.568,12345.569,12345.567),1)
 > max.col(x)
[1] 3
 > x <- matrix(c(112345.568,112345.569,112345.567),1)
 > max.col(x)
[1] 3
 > max.col(-x)
[1] 1

Thanks, Daryl



More information about the R-help mailing list