powered by
Computes the cosine distance between numeric vectors (1 minus cosine similarity).
cosine_dist(m)
A dist object of pairwise cosine distances.
dist
the data matrix (rows are vectors).
a <- c(2, 1, 0, 2, 0, 1, 1, 1) b <- c(2, 1, 1, 1, 1, 0, 1, 1) sim <- cosine_dist(rbind(a,b))
Run the code above in your browser using DataLab