使用R创建wordcloud时出错

问题描述

我正在使用以下CSV文件(用法语编写):

words_list= ["I","am","x","years","old"] # sentence having missing value as "x"
val = input("how many years old are you ?") # input the value of "x"
words_list[2] = val # replace the value of "x" at right place
print(' '.join(word for word in words_list)) # get the output with missing owrd at right place as sentence

我想用wordcloud2库创建一个wordcloud。

这是我写的R脚本:

"1";"Paul is in the kitchen"
"2";"Peter is cooking in the living-room"
"3";"The kitchen is beautiful"

但是出现以下错误:

 data <- read.csv('file.csv',sep="|",quote="",header=TRUE)
 dim(data)
 library(tm)

 documents <- Corpus(VectorSource(data))
 inspect(documents)

 lapply(documents[1],as.character)
 inspect(documents)

 set.seed(1234)

 tdm <- TermDocumentMatrix(documents)
 m <- as.matrix(tdm)
 v <- sort(rowSums(m),decreasing=TRUE)
 d <- data.frame(freq = v)
 d$word=rownames(d)

 library("wordcloud2")
 wordcloud2(d)

您怎么看?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...