knneighbor: KNNeighbor

Description Usage Arguments Value Author(s)

View source: R/knneighbor.R

Description

returns the k nearest neighbors to x in the data.

Usage

1
knneighbor(x, k, data, defined, distance)

Arguments

x

a row vector, who's k nearest neighbors in the data are sought.

k

An integer, giving the number of nearest neighbors to x, that are sought.

data

A matrix, containing the data as row vectors.

defined

A row vector of the same length as x, containing 1 for all columns of the data that are used for the calculation. If defined is missing, all columns are used.

distance

the distance measure that is used, e.g. euclidean, minkovsky... If none is given, euclidean is the default

Value

nNInd

a vector, containing the indices of the k rows of data that are the k nearest neighbours of x.

nNData

A matrix, containing the k nearest neighbours of x as row vectors

nNDists

A vector containing the distances of x to the corresponding k nearest neighbours.

Author(s)

Raphael Paebst


Mthrun/Distances documentation built on Feb. 4, 2020, 8:39 p.m.