Description Usage Arguments Value Author(s) References Examples
Utilizes the slam package to efficiently calculate cosine distance on large sparse matrices.
1 2 3 4 5 6 7 | cosine_distance(x, ...)
## S3 method for class 'DocumentTermMatrix'
cosine_distance(x, ...)
## S3 method for class 'TermDocumentMatrix'
cosine_distance(x, ...)
|
x |
A data type (e.g., |
... |
ignored. |
Returns a cosine distance object of class "dist"
.
Michael Andrec and Tyler Rinker <tyler.rinker@gmail.com>.
http://stackoverflow.com/a/29755756/1000343
1 2 3 4 5 6 | library(gofastr)
library(dplyr)
out <- presidential_debates_2012 %>%
with(q_dtm(dialogue)) %>%
cosine_distance()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.