Minkowski_Distance | R Documentation |
Minkowski Distance function
Minkowski_Distance(X, v, p)
X |
n x m matrix or numeric dataframe |
v |
1 x m vector |
p |
positive non-zero integer |
column matrix of (Minkowski) distances between the rows of X and a vector v
X = matrix(c(4,3,2,8,9,5), nrow = 3) v = c(10,7) p = 2 Minkowski_Distance(X,v,p) #Returns the following: # [37,53,68]' X = matrix(c(1,2,3,4,5,6), nrow = 3) v = c(10,3) p = Inf Minkowski_Distance(X, v, p) # Returns the following: # [9, 8, 7]'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.