On Building Word Clouds with R

mauricio_j_guadmauricio_j_guad Member Posts: 2 Newbie
edited June 2019 in Help

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

  • hughesfleming68hughesfleming68 Member Posts: 323 Unicorn
    edited April 2019
    Try to get your R code working in R studio before using it in Rapidminer. You can save a lot of time. I believe Thomas Ott did a blog post on Word Clouds with R and Rapidminer. Take a look at neuralmarkettrends.com.

    https://www.neuralmarkettrends.com/word-clouds-rapidminer-r
  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
    or...you can just do a word cloud in the new RM Studio visualizations?? :wink:
Sign In or Register to comment.