【发布时间】:2020-12-11 22:44:36
【问题描述】:
我正在尝试运行此代码来创建我在课堂上看到的 wordcloud。但是我无法通过尝试绘制 wordcloud 时出现的错误找到解决问题。错误是: wordcloud 中的错误(dfCorpus,max.words = 100,random.order = FALSE): 无法找到“wordcloud”功能。有人可以帮忙吗?
install.packages("tm", "SnowballC", "worldcloud", "RColorBrewer")
library(tm, SnowballC,worldcloud,RColorBrewer)
df <- read.csv('C:/r_fundamentos/parte2/questoes.csv', sep = ",")
head(df)
dfCorpus <-Corpus(VectorSource(df$Question))
class(dfCorpus)
dfCorpus <- tm_map(dfCorpus, PlainTextDocument)
dfCorpus <- tm_map(dfCorpus,removePunctuation)
dfCorpus <- tm_map(dfCorpus, removeWords, stopwords("english"))
dfCorpus <- tm_map(dfCorpus, stemDocument)
dfCorpus <- tm_map(dfCorpus, removeWords, c("the", "this", c(stopwords("english"))))
wordcloud(dfCorpus, max.words = 100, random.order = FALSE)
【问题讨论】:
-
“wordcloud”的拼写错误。
标签: r data-science word-cloud