如何用 R 创建黑白词云?
根据 Google 的说法,词云是一种由特定文本或主题中使用的单词组成的图像,其中每个单词的大小表示其频率或重要性。在 R 中,我们可以使用 wordcloud 软件包的 wordcloud 函数创建词云。因此,我们具有与该软件包相同的函数名,因此我们不应该因此感到困惑。
加载 wordcloud 软件包并创建词云 −
library("wordcloud")
x<-c("tutorialspoint is one of the best free resources for online learning")
wordcloud(x)警告信息 −
- 在 tm_map.SimpleCorpus(corpus, tm::removePunctuation) 中 −
变换会删除文档
- 在 tm_map.SimpleCorpus(corpus, function(x) tm::removeWords(x, tm::stopwords())) 中 −
变换会删除文档
输出

让我们来看另一个示例 −
y<-c("covid-19 has changed almost everything that happens around the world")
wordcloud(y)警告信息 −
- 在 tm_map.SimpleCorpus(corpus, tm::removePunctuation) 中 −
变换会删除文档
- 在 tm_map.SimpleCorpus(corpus, function(x) tm::removeWords(x, tm::stopwords())) 中 −
变换会删除文档
输出

广告
数据结构
网络连接
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP