Learn R Programming

tm (version 0.3-1)

dissimilarity: Dissimilarity

Description

Compute the dissimilarity between documents in a term-document matrix or between two explicit documents.

Usage

## S3 method for class 'TermDocumentMatrix':
dissimilarity(x, y = NULL, method)
## S3 method for class 'PlainTextDocument':
dissimilarity(x, y = NULL, method)

Arguments

x
Either a term-document matrix or a text document.
y
A text document. Only used if x is a text document.
method
Dissimilarity measure. Any method accepted by dist from package proxy can be passed over.

Value

  • An object of class dist representing the dissimilarity between participating documents.

Examples

Run this code
data("crude")
tdm <- TermDocumentMatrix(crude)
dissimilarity(tdm, method = "cosine")
dissimilarity(crude[[1]], crude[[2]], method = "eJaccard")

Run the code above in your browser using DataLab