find_neighbors: K Nearest Neighbour Search

Description Usage Arguments Value Author(s) Examples

View source: R/cluster.R

Description

Uses a kd-tree to find the p number of near neighbours for each point in an input/output dataset. Use the nn2 function from the RANN package, utilizes the Approximate Near Neighbor (ANN) C++ library, which can give the exact near neighbours or (as the name suggests) approximate near neighbours to within a specified error bound. For more information on the ANN library please visit http://www.cs.umd.edu/~mount/ANN/.

Usage

1

Arguments

data

matrix; input data matrix

k

integer; number of nearest neighbours

Value

a n-by-k matrix of neighbor indices

Author(s)

Hao Chen <chen_hao@immunol.a-star.edu.sg>

Examples

1
2
3
iris_unique <- unique(iris) # Remove duplicates
data <- as.matrix(iris_unique[,1:4])
neighbors <- find_neighbors(data, k=10)

flowSpy documentation built on Nov. 8, 2020, 6:53 p.m.