knn: Find k nearest neighbors

Description Usage Arguments Value

Description

Takes in a matrix and a number, k nearest neighbors

Usage

1
knn(x, i, dist = euclidean, k = 2, ...)

Arguments

x

A matrix of all dots, each row represents a dot

i

A numeric represents which row to calculate

dist

The method to calculate the distance, default is euclidean distance

k

A numeric represents the number of neighbors

Value

Return a list of k nearest distance and row number


chengfeifan/myCCM documentation built on May 13, 2019, 3:40 p.m.