[R] Applying a function on n nearest neighbours

Karl Ove Hufthammer karl at huftis.org
Fri Oct 30 10:39:21 CET 2009


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




More information about the R-help mailing list