## Define two numeric vectors with equal lengths (> 4).
x <- c(1, 2, 3, 4, 5)
y <- c(5, 6, 7, 8, 9)
## Calculate the L1 distance between the vectors x and y
L1.dist(x, y)
## Calculate the Euclidian distance between the vectors x and y
euclidian.dist(x, y)
## Calculate the cosine distance between the vectors x and y
cosin.dist(x, y)
## Calculate the rank-correlation distance between the vectors x and y
rank.cor.dist(x, y)
Run the code above in your browser using DataLab