Description Usage Arguments Value
View source: R/closest_in_vector.R
Return the k elements of a vector closest (in terms of Euclidean distance) to a reference value, as well as those elements' indices in the vector.
1 | closest_in_vector(x, vec, k = 1)
|
x |
Reference value |
vec |
Vector |
k |
How many closest neighbours to return |
A data frame with the following columns, sorted by increasing distance:
index
Index of element (i.e. value
is the same as vec[index]
)
value
Element
dist
Euclidean distance of element to reference value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.