如何在Wordcloud中显示频率 [英] How to display frequency in wordcloud

查看:132
本文介绍了如何在Wordcloud中显示频率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用wordcloud包在R中生成wordcloud.这是很容易的部分,但是似乎我缺少弄清楚如何在出现在wordcloud中的单词旁边显示频率.我到处都在搜索,但没有找到任何东西.谁能帮我吗?

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?

我正在使用的代码是:

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) 

推荐答案

尝试一些类似的事情:

library(wordcloud)
words <- c("foo", "bar")
freqs <- c(10, 3)
wordcloud(words = sprintf("%s (%s)", words, freqs), freq = freqs)

?sprintf?paste可能会有所帮助.

?sprintf and ?paste might be helpful.

这篇关于如何在Wordcloud中显示频率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆