Plot a word cloud from a dtm
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, ... )
dtm |
the document-term matrix |
nterms |
the amount of words to plot (default 100) |
freq.fun |
if given, will be applied to the frequenies (e.g. sqrt) |
terms |
the terms to plot, ignored if dtm is given |
freqs |
the frequencies to plot, ignored if dtm is given |
scale |
the scale to plot (see wordcloud::wordcloud) |
min.freq |
the minimum frquency to include (see wordcloud::wordcloud) |
rot.per |
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') dtm_wordcloud(dtm, nterms = 20) ## or without a DTM dtm_wordcloud(terms = c('in','the','cloud'), freqs = c(2,5,10))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.