neighbors {dissUtils} | R Documentation |
Given one (or two) multivariate data sets, a difference method, and k
neighbors to search for, neighbors
finds the k points in the
data set (or the second data set) that are closest to each point in
the data set (or the first data set)
neighbors(X, Y = NULL, method = "euclidean", n.neighbors = 1, init.info = NULL)
X |
a matrix of numeric values |
Y |
an optional second matrix that must have the same number of columns
as |
method |
one of the method choices from |
n.neighbors |
an integer between 1 and nrow(X) (or nrow(Y), if it is not null) |
init.info |
some difference methods require additional information. see
|
returns an nrow(X)
by n.neighbors
matrix of distances