How to display frequency in wordcloud

这一生的挚爱 提交于 2019-12-14 03:36:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!