powered by
returns the index of the nearest neighbour of a given data point.
nearest(Data, i, defined)
The index of the nearest neighbour of data[i, ]
A matrix holding n data points as row vectors.
the index of the data point, who's nearest neighbour is sought.
A row vector with 1 for all columns of data that are used for the computation. If missing, all columns are used.
Michael Thrun, Raphael Paebst
nearest(Data = as.matrix(iris[,1:4]), i = 1)
Run the code above in your browser using DataLab