
Last chance! 50% off unlimited learning
Sale ends in
Compute the term frequencies for the dtm and plot a word cloud with the top n topics You can either supply a document-term matrix or provide terms and freqs directly (in which case this is an alias for wordcloud::wordcloud with sensible defaults)
dtm_wordcloud(
dtm = NULL,
nterms = 100,
freq.fun = NULL,
terms = NULL,
freqs = NULL,
scale = c(4, 0.5),
min.freq = 1,
rot.per = 0.15,
...
)
the document-term matrix
the amount of words to plot (default 100)
if given, will be applied to the frequenies (e.g. sqrt)
the terms to plot, ignored if dtm is given
the frequencies to plot, ignored if dtm is given
the scale to plot (see wordcloud::wordcloud)
the minimum frquency to include (see wordcloud::wordcloud)
the percentage of vertical words (see wordcloud::wordcloud)
other arguments passed to wordcloud::wordcloud
## create DTM
tc = create_tcorpus(sotu_texts[1:100,], doc_column = 'id')
tc$preprocess('token', 'feature', remove_stopwords = TRUE)
dtm = get_dtm(tc, 'feature')
# \donttest{
dtm_wordcloud(dtm, nterms = 20)
## or without a DTM
dtm_wordcloud(terms = c('in','the','cloud'), freqs = c(2,5,10))
# }
Run the code above in your browser using DataLab