knn_lookup: Find nearest neighbour

Description Usage Arguments Details

Description

Lookup nearest neighbours data in a data.frame.

Usage

1
2
knn_lookup(df, points, k, ignore.colnames = FALSE, square.distance = TRUE,
  df.cols = NULL, points.cols = NULL, distance.name = "distance")

Arguments

df

data.frame, preferably indexed using flanner, in which to look for neighbours

points

data.frame containing coordinates to lookup neighbours of

k

number of neighbours to find

ignore.colnames

whether to interpret points by column numbers of column names (defaults to the latter)

square.distance

whether to return distances squared (default, which is faster)

df.cols

columns from df to return (defaults to all)

points.cols

columns from points to return (defaults to any not used for lookup) c() for none

distance.name

column name containing distances in result, NULL to not include

Details

The returned data frame contains all columns specified in df.cols and pointer.cols as well as a column with distances if distance.name is non-null.


rossklin/flanner documentation built on May 27, 2019, 11:39 p.m.