R 我想把文字画出来,而不是数字

R 我想把文字画出来,而不是数字,r,R,我正在学习如何使用术语频率和TF-IDF绘制单词云。 我已将文档术语矩阵转换为标准矩阵,然后使用word cloud尝试绘制它,但它绘制的是数字而不是单词 tweet.matrix = as.matrix(tweet.dtm) # converting to a standard R matrix freqs = rowSums(tweet.matrix) wordcloud(names(freqs), max.words =30, freqs, random.order=FALSE, m

我正在学习如何使用术语频率和TF-IDF绘制单词云。 我已将文档术语矩阵转换为标准矩阵,然后使用word cloud尝试绘制它,但它绘制的是数字而不是单词

tweet.matrix = as.matrix(tweet.dtm) # converting to a standard R matrix


freqs = rowSums(tweet.matrix)

wordcloud(names(freqs), max.words =30, freqs, random.order=FALSE, min.freq=3)
找到了错误。 因此,在代码的下面部分,它应该是colSums而不是rowSums

freqs = rowSums(tweet.matrix)
正确的代码是:

freqs = colSums(tweet.matrix)