Plot a dfm or tokens object as a wordcloud, where the feature labels are plotted with their sizes proportional to their numerical values in the dfm. When comparison = TRUE, it plots comparison word clouds by document.

textplot_wordcloud(x, comparison = FALSE, ...)

Arguments

x a dfm object if TRUE, plot a comparison.cloud instead of a simple wordcloud, one grouping per document additional parameters passed to to wordcloud or to text (and strheight, strwidth)

Details

The default is to plot the word cloud of all features, summed across documents. To produce word cloud plots for specific document or set of documents, you need to slice out the document(s) from the dfm or tokens object. Comparison word cloud plots may be plotted by setting comparison = TRUE, which plots a separate grouping for each document in the dfm. This means that you will need to slice out just a few documents from the dfm, or to create a dfm where the "documents" represent a subset or a grouping of documents by some document variable.

wordcloud, comparison.cloud

Examples

# plot the features (without stopwords) from Obama's two inaugural addresses
mydfm <- dfm(corpus_subset(data_corpus_inaugural, President=="Obama"), verbose = FALSE,
remove = stopwords("english"))
})