Use the wordcloud package to plot a wordcloud for a particular topic
cloud(stmobj, topic = NULL, type = c("model", "documents"), documents,
thresh = 0.9, max.words = 100, ...)
The STM model object to be used in making the word cloud.
NULL to plot the marginal distribution of words in the corpus, or a single integer indicating the topic number.
Specifies how the wordcloud is constructed. The type
"model"
which is used by default is based on the probability of the
word given the topic. The type "documents"
plots words within
documents that have a topic proportion of higher than thresh
. This
requires that the documents
argument also be specified.
The documents object of the same kind as passed to
stm
. This is only necessary if type="documents"
.
The threshold for including a document in the
type="documents"
setting.
The maximum number of words to be plotted.
Additional parameters passed to wordcloud
.
Uses the wordcloud package to make a word cloud of a particular topic.
The option "model"
uses the topic-word model parameters. Thus it
shows words weighted by their probability conditional that the word comes
from a particular topic. With content covariates it averages over the
values for all levels of the content covariate weighted by the empirical
frequency in the dataset. The option "documents"
plots the words
which appear in documents that have a topic proportion higher than
thresh
. Thus "model"
gives a pure model based interpretation
of the topic while "documents"
gives a picture of all the words in
documents which are highly associated with the topic.
Ian Fellows (2014). wordcloud: Word Clouds. R package version 2.5. https://cran.r-project.org/package=wordcloud
# NOT RUN {
cloud(gadarianFit, 1)
# }
Run the code above in your browser using DataLab