| dist_make | R Documentation | 
Make a distance matrix using a custom distance function
dist_make(x, distance_fcn, ...)
| x | A matrix of observations, one per row | 
| distance_fcn | A function used to compute the distance between two
rows of the data matrix.  The two rows will be passed as the first and
second arguments to  | 
| ... | Additional arguments passed to  | 
We do not set the call or method attributes of the
dist object.
A dist object containing the distances between rows of the
data matrix.
x <- matrix(sin(1:30), nrow=5)
rownames(x) <- LETTERS[1:5]
manhattan_distance <- function (v1, v2) sum(abs(v1 - v2))
dist_make(x, manhattan_distance)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.