Learn R Programming

rflann (version 1.3)

Neighbour: K nearest neighbours

Description

K nearest neighbours

Usage

Neighbour(query, ref, k, build = "kdtree", cores = 0, checks = 1)

Arguments

query
Matrix or data frame containing the set of query points where each row represents a point.
ref
Matrix or data frame containing the set of reference points where each row represents a point.
k
Number of nearest neighbours to search for.
build
String indicating the search structure to be used: "kdtree", "kmeans", "linear"
cores
Number of cpu cores to be used for searching. If 0, then the maximum allowable cores are used.
checks
Number of checks during searching. Higher value gives better search precision but takes longer. See FLANN C++ manual for more details.

Value

List containing:

Examples

Run this code
## Find the nearest neighbour using a KD Tree
query <- matrix(rnorm(10), ncol = 2)
reference <- matrix(rnorm(10), ncol = 2)
Neighbour(query, reference, 3, "kdtree", 0, 1)

Run the code above in your browser using DataLab