Description Usage Arguments Value Examples
Returns the indices of the top k rows in a dataframe that are closest to a given obversation (point) based on a specificed distance metric.
1 | get_closest(point, data, top_k, metric = "euclidean")
|
point |
Vector, values defining a single observation to compute distances for |
data |
Dataframe, values of all observations to calculate distances from point |
top_k |
Integer, number of closest observations to return indices for |
metric |
Char, type of distance metric to use in distance calculations |
Vector, indices of the closest k observations from data
1 2 | df <- data.frame(x=c(1, 1), y=c(1,2))
get_closest(c(1,1), df, 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.