Learn R Programming

mateable (version 0.3.2)

kNearNeighbors: Get k Nearest Neighbors

Description

Find the k nearest neighbors for all individuals in a population. This function is simply a wrapper for FNN::knn.dist.

Usage

kNearNeighbors(scene, k)

Value

a matrix where the rows are all individuals and the columns are their k nearest neighbors

Arguments

scene

a matingScene object

k

integer of how many nearest neighbors to get

See Also

knn.dist, proximity

Examples

Run this code
pop <- simulateScene(10)
kNearNeighbors(pop, 3)

Run the code above in your browser using DataLab