On Tue, 25 Aug 2020 14:26:43 +0200 Mike <mi...@posteo.nl> wrote: > But which.min only does so if the values don't contain fractions. > And I get > > > identical (data3ba, c(2.9,2.9)) > [1] FALSE > > Why is which.min not always returning 1 but which.max does?
It's the unfortunate consequence of the way floating point numbers work: data3ba - 2.9 # [1] 0.000000e+00 -4.440892e-16 See R FAQ 7.31: https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.