On Building Word Clouds with R

mauricio_j_guad
mauricio_j_guad New Altair Community Member
edited November 5 in Community Q&A

Hello. I am getting the error message "The Execution of RScript Failed". I am very unfamiliar with R and need basic help to display a Word Cloud on RapidMiner from a previously made wordlist. My script is below, please help.

# rm_main is a mandatory function,
# the number of arguments has to be the number of input ports (can be none)
rm_main = function(data)
{
 # Install
 
 install.packages("tm", repos=Link Goes Here)  # for text mining
 install.packages("SnowballC", repos=
Link Goes Here) # for text stemming
 install.packages("wordcloud", repos=
Link Goes Here) # word-cloud generator
 install.packages("RColorBrewer", repos=
Link Goes Here) # color palettes


 #Load
 library("tm")
 library("SnowballC")
 library("wordcloud")
 library("RColorBrewer") 
    
 print('Hello, world!')
 set.seed(1234)
 for (i in 0:9) {
 d=data[data$topicId==i,]
 print(d)
 jpeg(paste("C:/WordCloudImage.jpg",i,".jpg",sep=""), width=400, height=400)
 wordcloud(words = d$word, freq = d$weight, random.order=FALSE, rot.per=0.35,
          colors=brewer.pal(8, "Dark2"))
 dev.off()
}

}

Answers