Whenever I am running the wordcloud in R studio its not doing anything facing this issue from last week

install.packages('tm')
install.packages('ggplot')
install.packages('wordcloud')
install.packages('lubridate')
install.packages("twitteR")
install.packages('wordcloud')
library('twitteR')
library('tm')
library('ggmap')
library('ggplot2')
library('stringr')
library('worldcloud')
library('lubridate')
library('data.table')

Connect to twitter app

Consumer_secret<- ""
Consumer_key<- ""
Access_token<-""
Access_secret<-""
setup_twitter_oauth(consumer_secret = Consumer_secret, consumer_key = Consumer_key,access_token = Access_token,access_secret = Access_secret)

twitterUser<-getUser("narendramodi")
tweets<-userTimeline(twitterUser,n=1000)
newnarendratweets.df<-twListToDF(tweets)
newnarendratweets.df$text<-sapply(newnarendratweets.df$text, function(x) iconv(x,to='UTF-8' ))
newnarendratweets.df$created<-ymd_hms(newnarendratweets.df$created)

#Plot tweets by time
ggplot(data = newnarendratweets.df, aes(x=created))+geom_histogram(aes(fill=..count..))+
theme(legend.position = "none")+xlab("Month")+ylab("Number of tweets")+ scale_fill_gradient(low="midnightblue", high="aquamarine4")

ggplot(data = trendingtweets.df, aes(x=created))+geom_histogram(aes(fill=..count..))+
theme(legend.position = "none")+xlab("Date")+ylab("Number of tweets")+ scale_fill_gradient(low="midnightblue", high="aquamarine4")

#WordCloud for trending tweets
tweetsaccount<-str_extract_all(trendingtweets.df$text,"@\w+")
namesCorpus<-Corpus(VectorSource(tweetsaccount))
pal<-brewer.pal(5,"YlGnBu")
pal<-pal[-(1:4)]
wordcloud(words = namesCorpus,scale = c(3,.5),max.words = 100,random.order = FALSE,random.color = FALSE,use.r.layout = TRUE,rot.per = .10,colors = pal)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.