Last chance! 50% off unlimited learning
Sale ends in
comparison = TRUE
, it plots comparison word clouds by
document.
textplot_wordcloud(x, comparison = FALSE, ...)
TRUE
, plot a
comparison.cloud
instead of a simple wordcloud,
one grouping per documentcomparison =
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
# 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"))
textplot_wordcloud(mydfm)
# plot in colors with some additional options passed to wordcloud
textplot_wordcloud(mydfm, random.color = TRUE, rot.per = .25,
colors = sample(colors()[2:128], 5))
## Not run:
# # comparison plot of Irish government vs opposition
# docvars(data_corpus_irishbudget2010, "govtopp") <-
# factor(ifelse(data_corpus_irishbudget2010[, "party"] %in% c("FF", "Green"), "Govt", "Opp"))
# govtoppDfm <- dfm(data_corpus_irishbudget2010, groups = "govtopp", verbose = FALSE)
# textplot_wordcloud(tfidf(govtoppDfm), comparison = TRUE)
# # compare to non-tf-idf version
# textplot_wordcloud(govtoppDfm, comparison = TRUE)
# ## End(Not run)
Run the code above in your browser using DataLab