问题
I'm trying to generate a wordcloud in R with the package wordcloud. That's the easy part, but it seems i'm lacking figuring out how to display the frequency next to the words that appear in the wordcloud. I've been searching everywhere but didn't find anything. Can anyone help me?
The code i'm using is:
wordcloud(Table$words, Table$freq, scale=c(2.5,0.5),m ax.words = 150,
min.freq = 10, random.order=FALSE, rot.per=0.1,
use.r.layout=FALSE, random.color = F, colors=rainbow)
回答1:
Try something in the veins of this:
library(wordcloud)
words <- c("foo", "bar")
freqs <- c(10, 3)
wordcloud(words = sprintf("%s (%s)", words, freqs), freq = freqs)
?sprintf
and ?paste
might be helpful.
来源:https://stackoverflow.com/questions/34298725/how-to-display-frequency-in-wordcloud