Neighbour: K nearest neighbours

Description Usage Arguments Value Author(s) Examples

Description

K nearest neighbours

Usage

1
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:

indices

Matrix containing the index of the nearest neighbours in the reference set for each query set of points

distances

Matrix containing the distances to the nearest neighbours

Author(s)

Yee, Jeremy

Examples

1
2
3
4
## 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)


Search within the rflann package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.