Hello, I suppose this is a general behavior with external function calls, so I do not post (yet) a specific bug report. Could someone explain this?
a <- rep(1, 20) + rnorm(20, mean=0.00001, sd=0.0001) b <- embed(a, 3) # I want to know where the item in column 2 is greated than both col 1 and 3 (peak) test1 <- max.col(b) == 2 # ... or I could use a less optimal code test2 <- apply(b, 1, max) == b[, 2] any(test1 != test2) # both are equivalent # but when numbers are very close a <- rep(1, 20) + rnorm(20, mean=0.0000001, sd=0.0000001) b <- embed(a, 3) test1 <- max.col(b) == 2 test2 <- apply(b, 1, max) == b[, 2] any(test1 != test2) # tests are now DIFFERENT! # Indeed, test2 is correct, and test1 suffers from wrong calculations due probably to rounding errors in max.col() Best, Philippe Grosjean ...........]<(({°<...............<°}))><............................... ) ) ) ) ) ( ( ( ( ( Dr. Philippe Grosjean ) ) ) ) ) ( ( ( ( ( LOV, UMR 7093 ) ) ) ) ) Station Zoologique ( ( ( ( ( Observatoire Océanologique ) ) ) ) ) BP 28 ( ( ( ( ( 06234 Villefranche sur mer cedex ) ) ) ) ) France ( ( ( ( ( ) ) ) ) ) tel: +33.4.93.76.38.16, fax: +33.4.93.76.38.34 ( ( ( ( ( ) ) ) ) ) e-mail: [EMAIL PROTECTED] ( ( ( ( ( SciViews project coordinator (http://www.sciviews.org) ) ) ) ) ) ....................................................................... ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-devel