# NOT RUN {
# For example, the following command will calculate the 5 nearest neighbors
# of each point in "input" and store the distances in "distances" and the
# neighbors in "neighbors":
# }
# NOT RUN {
output <- knn(k=5, reference=input)
neighbors <- output$neighbors
distances <- output$distances
# }
# NOT RUN {
# The output is organized such that row i and column j in the neighbors
# output matrix corresponds to the index of the point in the reference set
# which is the j'th nearest neighbor from the point in the query set with
# index i. Row j and column i in the distances output matrix corresponds to
# the distance between those two points.
# }
Run the code above in your browser using DataLab