Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot

Visualize a Term-Document Matrix


Description

Visualize correlations between terms of a term-document matrix.

Usage

## S3 method for class 'TermDocumentMatrix'
plot(x,
     terms = sample(Terms(x), 20),
     corThreshold = 0.7,
     weighting = FALSE,
     attrs = list(graph = list(rankdir = "BT"),
                  node = list(shape = "rectangle",
                              fixedsize = FALSE)),
     ...)

Arguments

x

A term-document matrix.

terms

Terms to be plotted. Defaults to 20 randomly chosen terms of the term-document matrix.

corThreshold

Do not plot correlations below this threshold. Defaults to 0.7.

weighting

Define whether the line width corresponds to the correlation.

attrs

Argument passed to the plot method for class graphNEL.

...

Other arguments passed to the graphNEL plot method.

Details

Visualization requires that package Rgraphviz is available.

Examples

## Not run: data(crude)
tdm <- TermDocumentMatrix(crude,
                          control = list(removePunctuation = TRUE,
                                         removeNumbers = TRUE,
                                         stopwords = TRUE))
plot(tdm, corThreshold = 0.2, weighting = TRUE)
## End(Not run)

tm

Text Mining Package

v0.7-8
GPL-3
Authors
Ingo Feinerer [aut, cre] (<https://orcid.org/0000-0001-7656-8338>), Kurt Hornik [aut] (<https://orcid.org/0000-0003-4198-9911>), Artifex Software, Inc. [ctb, cph] (pdf_info.ps taken from GPL Ghostscript)
Initial release
2020-11-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.