On Fri, 30 Oct 2009 10:28:49 +0100 Karl Ove Hufthammer <karl at huftis.org> wrote: > $ (pos=which(order(abs(iris$Sepal.Length-x)) %in% 2:6)) This should of course be: (pos=order(abs(iris$Sepal.Length-x))[2:6]) -- Karl Ove Hufthammer