cosine | R Documentation |
Computes cosine similarity
cosine(x, y = NULL, ...)
x |
Numeric vector, matrix, or data frame.
If |
y |
Numeric vector, matrix, or data frame.
Only used if |
... |
Not actually used but makes it easier for general functionality in the package |
On missing values: 0
will be used to replace missing values.
When using (matrix) multiplication, the 0
value cancels out the
product rendering the missing value as "not counting" in the sums
Alexander P. Christensen <alexpaulchristensen@gmail.com>
# Load data
wmt <- wmt2[,7:24]
# Obtain cosines
wmt_cosine <- cosine(wmt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.