Description Usage Arguments Value Examples
View source: R/get_all_distances.R
Compares an input reference vector (point) to all rows of an input data frame, calculating the specified distance/similarity metric for each row.
1 | get_all_distances(point, data, metric = "euclidean")
|
point |
vector of length k to compare to the data frame |
data |
data frame of size n by k to compare ref_vec to |
metric |
string, default value "euclidean" for euclidean distance, "cosine" will return cosine similiarity distance, and "manhattan" will return manhattan distance |
numeric vector of length n
1 2 3 | df <- data.frame("A" = c(1,2,3), "B" = c(8,2,4))
ref_vec <- c(-2,4)
get_all_distances(ref_vec, df, metric = "euclidean")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.