cosine_distance: Optimized Computation of Cosine Distance

Description Usage Arguments Value Author(s) References Examples

View source: R/cosine_distance.R

Description

Utilizes the slam package to efficiently calculate cosine distance on large sparse matrices.

Usage

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)

Arguments

x

A data type (e.g., DocumentTermMatrix or TermDocumentMatrix).

Value

Returns a cosine distance object of class "dist".

Author(s)

Michael Andrec and Tyler Rinker <[email protected]>.

References

http://stackoverflow.com/a/29755756/1000343

Examples

1
2
3
4
5
6
library(gofastr)
library(dplyr)

presidential_debates_2012 %>%
    with(q_dtm(dialogue)) %>%
    cosine_distance()

trinker/hclustext documentation built on May 27, 2017, 1:47 p.m.