# install.packages('RColorBrewer')
# install.packages('wordcloud')
library(RColorBrewer)
library(wordcloud)
# set workdir
# getwd()
setwd("D:/abctest")
# read the data from disk
data = read.csv("D:/abctest/yun.txt",sep=':')
# read the columns of dataframe
names(data)
levels(data$word)
levels(data$word)[18] <- 'comaple'
data <- rbind(data,c('comaple',0.015))
# set colors
colors=c('red','blue','green','maroon','brown','navy','purple','black')
# generate the word cloud
wordcloud(data$word,data$freq,scale=c(6,1),min.freq=0,max.words=100,colors=colors,random.order=F,random.color=T,ordered.colors=F,family='STKaiti')
错误代码Error in -freq : invalid argument to unary operator