| cosine | R Documentation |
Given a dataset, compute the cosine similarity between to columns for use in optimization of Dimensional Anchors
cosine(mat)
mat |
A matrix or data.frame |
implementation by ekstroem (see StackOverflow for details)
A symmetrical matrix with as many rows as there are columns in input
Yann Abraham
David Ruau
data(iris)
das <- c('Sepal.Length','Sepal.Width','Petal.Length','Petal.Width')
mat <- iris[,das]
sim.mat <- cosine(mat)
ncol(mat)
dim(sim.mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.