简体   繁体   English

R中数据框上的Wordcloud

[英]Wordcloud on dataframe in R

Being new to R, I am lacking a few basics. 作为R的新手,我缺少一些基础知识。 Is it possible to make a wordcloud on a dataframe? 是否可以在数据帧上创建wordcloud? my data is like: 我的数据像:

X  x
a  10
b  8
c  6
d  4

Can i make a workcloud on the above data where X is the word and x is its frequency? 我可以根据上述数据制作一个工作云,其中X是单词,x是它的频率?

You can. 您可以。 Just specify wordcloud(words = data$X, freq = data$x) 只需指定wordcloud(words = data$X, freq = data$x)

Be aware that by default the minimum frequency is set to 3. You might want to adjust this. 请注意,默认情况下,最小频率设置为3。您可能需要对此进行调整。 just check the help. 只需查看帮助即可。

    Just try for a sample 
    abc<-data.frame(X=LETTERS[1:26],x=sample(1:26))
    wordcloud(abc$X,abc$x,scale = c(5,.5),min.freq = 2,colors = brewer.pal(10,"Paired"))

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM