On Fri, 30 Oct 2009 10:28:49 +0100 Karl Ove Hufthammer
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
__
R-help@r-project.org mailing list
I'm having a problem where I have to apply a function to a subset of a
variable, where the subset is defined by the n nearest neighbours of a
second variable.
Here's an example applied to the 'iris' dataset:
$ head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1
2 matches
Mail list logo