On 3/28/2015 our news station (WPTV) posted about Obama coming to visit South Florida.
Posts about the president always get plenty of negative comments, so I thought it would be fun to display them in a word cloud.
It’s interesting when we get a bunch of “who cares” comments on a story. By taking the time to type out “who cares”, does that mean you do indeed care?
library(tm) library(wordcloud) library(Rfacebook) library(RColorBrewer) #For the color palette pal2 <- brewer.pal(8,"Dark2") #Color palette for the word cloud. # token generated here: https://developers.facebook.com/tools/explorer #These expire every 2 hours shell.exec("https://developers.facebook.com/tools/explorer") token = "xxxx" data <- getPage("mypage", token=token, n = 25, feed = TRUE) #I used the above dataset to pick out a post id that I wanted to analyze. #data$id id <- "xxxxx" #this is the post id. post <- getPost(id, token) text <- paste(unlist(post$comment$message), collapse = " ") text <- sapply(text,function(row) iconv(row, "latin1", "ASCII", sub="")) x11() wordcloud(text, col= pal2, min.freq = 10)