R/cosine.R
cosine.Rd
Calculate Cosine Measures
cosine(x, y)
a numeric vector or matrix with column representing vector to calculate similarity.
must be same format as x.
x
a numeric value or matrix.
matrix
x <- c(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0) y <- c(0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0) z1 <- cosine(x, y) z1 #> [1] 0.2357023 z2 <- cosine(matrix(x), matrix(y)) z2 #> [,1] #> [1,] 0.2357023