Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Facebook Sentiment Analysis - What is Facebook Saying about Nintendo?
1. Nintendo Sentiment Analysis
Gregory Zapata
November 25, 2016
The facebook page I chose for this assignment was Nintendo. Nintendo Co., Ltd. is a Japanese multinational consumer electronics and
software company and is one of the world’s largest video game companies. As of 31 March 2014, Nintendo has cumulative sales of over
670.43 million hardware units and 4.23 billion software units. I manually extracted their facebook page stats and these are displayed below.
library(knitr)
pagelabels <- c("Name: ", "Likes: ", "Contact Info: ", "Products: ")
pageinfo <- c("Nintendo", "4,147,065", "http://www.nintendo.com", "Wii U, Nintendo 3DS XL, Nintendo 3DS, Nint
endo DSi, Nintendo DSi XL, Nintendo DS Lite" )
pagestats <- cbind(pagelabels, pageinfo)
kable(pagestats, caption = "Page Stats")
Page Stats
pagelabels pageinfo
Name: Nintendo
Likes: 4,147,065
Contact Info: http://www.nintendo.com
Products: Wii U, Nintendo 3DS XL, Nintendo 3DS, Nintendo DSi, Nintendo DSi XL, Nintendo DS Lite
Nintendo’s Posts
I then extracted the 30 most recent posts made by the company on the page at that time. I wrote the posts to a CSV file for safe keeping and
then read it back into R in a separate data frame. This created a data frame of 30 objects with 17 variables; 30 posts and basic information
for each one (Post ID, Like Count,Comment Count, Reaction Counts, Etc.)
library(Rfacebook)
### nintendo <- getPage("Nintendo", token = my_oauth, n = 30, reactions = TRUE)
### write.csv(nintendo, "D:/Data Analytics/my data setz/nintendo.csv")
nintendoposts <- read.csv("D:/Data Analytics/Data Applications/hw2/GregZapatanintendoposts.csv")
str(nintendoposts)
2. ## 'data.frame': 30 obs. of 17 variables:
## $ X : int 2 3 1 4 5 6 7 9 8 10 ...
## $ id : Factor w/ 30 levels "119240841493711_1154914014593050",..: 2 3 1 4 5 6 7 9 8 10 ...
## $ likes_count : int 1439 10063 1495 5645 692 1577 688 7555 4815 612 ...
## $ from_id : num 1.19e+14 1.19e+14 1.19e+14 1.19e+14 1.19e+14 ...
## $ from_name : Factor w/ 1 level "Nintendo": 1 1 1 1 1 1 1 1 1 1 ...
## $ message : Factor w/ 25 levels "After many suns and many moons, all your training has prepared you
for Pokémon Sun and Pokémon Moon. Now available on Nintendo "| __truncated__,..: 13 21 4 16 NA 23 5 22 7 14 ..
.
## $ created_time : Factor w/ 30 levels "2016-10-26T20:02:19+0000",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ type : Factor w/ 4 levels "link","photo",..: 2 2 4 2 1 2 2 2 1 1 ...
## $ link : Factor w/ 29 levels "http://i.imgur.com/Xq0w9hK.gif",..: 9 10 26 11 29 12 13 14 1 5 ...
## $ story : Factor w/ 5 levels "Nintendo added 5 new photos.",..: NA NA NA NA 3 NA NA NA NA NA ...
## $ comments_count: int 82 543 115 301 42 157 44 740 149 82 ...
## $ shares_count : int 201 3594 240 980 0 132 37 3036 901 85 ...
## $ love_count : int 123 1243 144 637 68 144 53 840 282 66 ...
## $ haha_count : int 4 26 12 15 2 6 11 36 833 5 ...
## $ wow_count : int 27 518 55 419 20 51 8 299 6 28 ...
## $ sad_count : int 2 19 1 5 2 2 1 5 2 3 ...
## $ angry_count : int 4 25 5 11 4 13 8 23 3 6 ...
Below is an output of various Likes, Comment, and Reaction counts for each post and the total number of each respective count.
postdetails <- data.frame(cbind(nintendoposts$likes_count,
nintendoposts$comments_count,
nintendoposts$shares_count,
nintendoposts$love_count,
nintendoposts$haha_count,
nintendoposts$wow_count,
nintendoposts$sad_count,
nintendoposts$angry_count))
colnames(postdetails) <- c("Likes Count", "Comments Count", "Shares Count", "Love count", "HAHA Count", "WOW
Count", "Sad Count", "Angry Count")
postsums <- as.data.frame(colSums((postdetails[1:8]), na.rm = TRUE))
kable(postdetails, caption = "Post Overview")
Post Overview
Likes Count Comments Count Shares Count Love count HAHA Count WOW Count Sad Count Angry Count
1439 82 201 123 4 27 2 4
10063 543 3594 1243 26 518 19 25
1495 115 240 144 12 55 1 5
5645 301 980 637 15 419 5 11
692 42 0 68 2 20 2 4
1577 157 132 144 6 51 2 13
688 44 37 53 11 8 1 8
7555 740 3036 840 36 299 5 23
4815 149 901 282 833 6 2 3
612 82 85 66 5 28 3 6
4403 405 1004 673 18 100 3 16
474 59 24 36 1 17 4 6
2338 217 150 272 7 43 3 25
1545 108 23 127 13 13 11 161
8426 1432 765 810 33 75 59 904
3830 655 416 408 12 18 13 397
3. 6828 711 894 705 328 66 20 140
1941 1033 341 188 26 19 24 481
1592 780 97 125 13 15 4 124
5764 1205 1574 628 79 140 57 775
2881 293 1 330 24 48 18 189
1415 145 1 171 7 25 6 101
2208 206 259 262 9 55 5 6
628 123 35 53 3 20 0 2
1587 94 118 259 8 42 3 6
5893 1050 1505 686 22 597 46 98
1901 475 119 138 150 8 2 6
1766 173 247 145 1 50 1 12
1771 114 287 224 6 57 0 6
4604 1149 1107 429 17 394 36 67
Likes Count Comments Count Shares Count Love count HAHA Count WOW Count Sad Count Angry Count
kable(postsums, caption = "Count Totals")
Count Totals
colSums((postdetails[1:8]), na.rm = TRUE)
Likes Count 96376
Comments Count 12682
Shares Count 18173
Love count 10269
HAHA Count 1727
WOW Count 3233
Sad Count 357
Angry Count 3624
It appears Facbookers that frequent Nintendo’s page are giving them a lot of Loves and Angrys, and many people are sharing posts rather
than commenting ont them.
The function getPage() only extracts information about the post but not the posts themselves. I then used the getPost() function which
extracts in addition to the basic post information already acquiired, the likes and comments for that post as well.
#posts <- list()
#for (i in 1:30){
# posts[[i]]=getPost(post=nintendo[i,1],token=my_oauth,n=30000, comments = TRUE, likes = TRUE)
#}
Getting the Likes
The function getPost() returns all posts in a single nested list; a large list containing 30 lists (one for each post). The likes - which contains
the individual’s Name and Facebook ID - are contained within these nested lists and were extracted using a simple FOR loop.
4. # for (i in seq(1,29,by=2)){
# x<-posts[[i]]$likes
# y<-posts[[i+1]]$likes
# z<-rbind(x,y)
# nintendolikes<-rbind(nintendolikes,z)
#}
str(nintendolikes)
## 'data.frame': 95798 obs. of 2 variables:
## $ from_name: chr "Jordan Pietrandrea" "Luigy Advance" "Imad Eddine" "Julio Garcia" ...
## $ from_id : chr "1141173579323723" "832991150182919" "569861146546270" "756625961154698" ...
Getting the Comments
The comments - which contains the commentor’s name, message, etc. - were also contained within the nested list and were extracted using
a similar FOR loop.
#nintendocomments=NULL
#for (i in seq(1,29,by=2)){
# a<-posts[[i]]$comments
# b<-posts[[i+1]]$comments
# c<-rbind(a,b)
# nintendocomments<-rbind(nintendocomments,c)
#}
str(nintendocomments)
## 'data.frame': 11324 obs. of 7 variables:
## $ from_id : chr "1883673645185765" "10207293632085674" "921823351251918" "1254366947970656" ...
## $ from_name : chr "Victor Ramos" "Krystie Johnson" "Kevin Ramirez" "Michael Ponder Jr." ...
## $ message : chr "I hope that next time Nintendo you would make a better paper mario game that's ac
tually RPG from what it use to be and bring ba"| __truncated__ "Lol thanks xD this would have been cool when
we carved my 3 year old son's pumpkin. He did choose mario for a pumpkin and he's "| __truncated__ "Nintendo,
you and Atlus(should remaster Tokyo Mirage Sessions FE for the Nintendo Switch and maybe you should discuss w
ith them"| __truncated__ "This game was pretty terrible IMO. I hope the next Paper Mario gets back to it's ro
ots and you guys just stop making excuses.." ...
## $ created_time : chr "2016-10-27T06:14:56+0000" "2016-10-26T20:43:54+0000" "2016-10-27T00:55:59+0000" "
2016-10-27T05:07:55+0000" ...
## $ likes_count : num 3 3 1 4 1 3 1 0 15 1 ...
## $ comments_count: num 5 3 0 0 2 1 0 13 3 21 ...
## $ id : chr "1154935454590906" "1154935454590906" "1154935454590906" "1154935454590906" ...
Sentiment Analysis - Cleaning the Comments
In order to run sentiment analysis on the comments I needed to first clean the comments themselves. The cleaning process involved
converting the messages into ASCII, then making a corpus, then stripping the corpus of all punctuation marks, white space, etc., and then
making a data frame out of the cleaned corpus.
5. # remove hyperlinks and also trucated part of a tweet
#Encoding(nintendocomments$message) <- "latin1"
#nintendocomments$message<- iconv(nintendocomments$message, from = "latin1", to = "ASCII", sub="")
# Create a corpus. This is coming from the tm package
#nincorpus <-Corpus(VectorSource(nintendocomments$message))
# Clean the corpus
#nincorpus2 <- tm_map(nincorpus, content_transformer(tolower), mc.cores=1)
#nincorpus2 <- tm_map(nincorpus2, removeNumbers)
#nincorpus2 <- tm_map(nincorpus2, removeWords, stopwords())
#nincorpus2 <- tm_map(nincorpus2, removePunctuation)
#nincorpus2 <- tm_map(nincorpus2, stripWhitespace)
###### Sentiment analysis
# Convert the corpus to a data frame
#final <- data.frame(text=unlist(sapply(nincorpus2, `[`, "content")), stringsAsFactors=F)
kable(head(final))
text
1.content hope next time nintendo make better paper mario game actually rpg use bring back partners rather first ttyd new ones whatever
comes first nintendo switch
2.content lol thanks xd cool carved year old sons pumpkin choose mario pumpkin gonna mario halloween loving playing color splash
3.content nintendo atlus remaster tokyo mirage sessions fe nintendo switch maybe discuss possibly releasing persona switch well switch
deserves plenty amazing rpgs
4.content game pretty terrible imo hope next paper mario gets back roots guys just stop making excuses
5.content going share picture pumpkins wife carved will let comment picture mario luigi peach mushroom years ago
6.content remember beat special zone super mario world piranha plants change creepy jack o lantern creatures
Sentiment Analysis
To get a sentiment analysis for the comments we utilized functions from the syuzhet package. This provided us with overall sentiment for
each comment. I then got the totals for each sentiment and plotted them accordingly.
library(syuzhet)
library(ggplot2)
#sen2 <- syuzhet::get_nrc_sentiment(final$text)
#final$text
#head(sen2)
#sentfinal<-cbind(final$text,sen2)
#head(sentfinal)
#sentimentTotals <- data.frame(colSums(sentfinal[,c(2:11)]))
#names(sentimentTotals) <- "count"
#sentimentTotals <- cbind("sentiment" = rownames(sentimentTotals), sentimentTotals)
#rownames(sentimentTotals) <- NULL
ggplot(data = sentimentTotals, aes(x = sentiment, y = count)) +
geom_bar(aes(fill = sentiment), stat = "identity") +
theme(legend.position = "none") +
xlab("Sentiment") + ylab("Total Count") + ggtitle("Sentiment for all comments")
6. kable(sentimentTotals)
sentiment count
anger 2519
anticipation 4869
disgust 1593
fear 1838
joy 3341
sadness 2554
surprise 1985
trust 3437
negative 4828
positive 7739
Many of the comments received a positive sentiment. What’s interesting is that the next highest categories are Anticipation and Negative.
While it is good to see that many commentors are eagerly anticipating release of Nintendo’s upcoming products, just as many commentors
are responding negatively to Nintendo’s posts. In fact, Negative sentiment outranks both Joyful and Trustful comments. Now let’s compare
this to the overall reactions from each post….
#reactionTotals <- data.frame(colSums(postdetails[,-c(1,2,3)]))
#names(reactionTotals) <- "count"
#reactionTotals <- cbind("sentiment" = rownames(reactionTotals), reactionTotals)
#rownames(reactionTotals) <- NULL
ggplot(data = reactionTotals, aes(x = sentiment, y = count)) +
geom_bar(aes(fill = sentiment), stat = "identity") +
theme(legend.position = "none") +
xlab("Sentiment") + ylab("Total Count") + ggtitle("Reaction to all posts")
7. It certainly does appear that the overall sentiment gathered from the reactions does indeed correlate with the sentiment gathered from the
comments. The Love count far exceeded any of the other categories just as the Positive category outnumbered all the others in the comment
sentiment. Angry reactions had the second highest count which correlates with the overall comment sentiment where anger placed high
along with negative sentiment. WOW reaction had the third highest count, which correlates with Surprise in the comment sentiment count.
What is surprising is that Sadness had the lowest reaction count. However, considering that the only comment sentiments beaten out by
Sadness are Fear and Disgust and there are no reactions for Fear or Disgust, I believe this is an accurate representation of how sadness
ranks among the other reactions.
Top 10 Commenters
Next I decided to isolate the top ten people who commented the most on Nintendo’s page and see if the sentiment from their comments
differs from the overall comment sentiment. The IDs of the top ten commenters are displayed below along with sentiment totals for their
cummulative comments.
#top10 <- as.data.frame(table(nintendocomments$from_id))
#### Getting sentiment by commentors
#sen5 <- cbind(nintendocomments$from_id,nintendocomments$from_name, sen3)
## renamed columds
#colnames(sen5)[1] <- 'Commentor_ID'
#colnames(sen5)[2] <- 'Commentor_name'
### ran sentiment analysis grouped by commentor id
#commentors_sentiment <- as.data.frame(apply(sen5[,c(3:12)], 2, function(x) tapply(x,sen5$Commentor_ID,sum)))
#### combined data sets to ensure that observations are lining up by commentorID.
#comment_sentiment <- cbind(top10, commentors_sentiment)
# We only want the top 10, so ordered comment_sentiment by Freq
#comment_sentiment_ordered <- comment_sentiment[order(-comment_sentiment$Freq),]
# Selecting only the top ten commentors
#comment_sentiment_10 <- comment_sentiment_ordered[1:10,]
kable(comment_sentiment_10)
Var1 Freq anger anticipation disgust fear joy sadness surprise trust negative positive
520162728136529 520162728136529 27 0 1 0 0 4 0 0 7 0 14
1179322785450759 1179322785450759 19 0 57 0 0 19 0 19 19 0 38
1351547818202278 1351547818202278 19 1 18 1 12 17 1 16 3 15 18
8. 980481247353 980481247353 18 4 4 5 3 7 5 4 7 9 10
819247448177615 819247448177615 16 12 19 6 10 17 13 11 13 17 43
363019087367246 363019087367246 15 3 7 3 1 6 0 1 6 4 21
10154692710450763 10154692710450763 14 3 33 1 2 20 2 4 25 2 55
10154937847940628 10154937847940628 14 0 5 0 2 4 2 6 3 2 5
10155458284313312 10155458284313312 14 0 5 0 0 3 0 3 3 2 6
1095415193910879 1095415193910879 14 0 0 0 0 0 0 0 0 0 0
Var1 Freq anger anticipation disgust fear joy sadness surprise trust negative positive
Commenting Habits of the Top 10 Commenters
The sentiment total for these top ten commenters is displayed below.
sentimentTotals_10 <- data.frame(colSums(comment_sentiment_10[,c(3:12)]))
names(sentimentTotals_10) <- "count"
sentimentTotals_10 <- cbind("sentiment" = rownames(sentimentTotals_10), sentimentTotals_10)
rownames(sentimentTotals_10) <- NULL
ggplot(data = sentimentTotals_10, aes(x = sentiment, y = count)) +
geom_bar(aes(fill = sentiment), stat = "identity") +
theme(legend.position = "none") +
xlab("Sentiment") + ylab("Total Count") + ggtitle("Sentiment for top 10 commentators")
It appears that the most prolific commenters on Nintendo’s facebook page typically post messages that are comprised of Positive,
Anticipation, and Joyful sentiment; this correlates with the overall comment and reaction sentiment. However, it is noted that the top 10
commenters do not post nearly as much angry content as the entrire population of commenters. This is almost certainly due to the fact that
these Top 10 commenters are probably Nintendo loyalists who love Nintendo and their products and eagerly wait in anticipation for new
products to hit the shelves despite setbacks that may occur.On a side note, the 10th highest commenter had a sentiment of 0 for all
categories. This is most likely because this indicidual is not commenting but rather tagging other facebookers so they will be made aware of
the content on these posts. I believe this is still a good thing as it serves to spread product awareness and brand loyalty.
All this considered, I decided to take a look back at the posts themselves to see what people were feeling about them. In particular, the most
post that received the most likes and loves was the second post which contained a message regarding Nintendo’s upcoming release of its’
newest console, the Nintendo Switch. The angriest post was a post which contained a message regarding the NES classic edition - a
miniaturized version of the original NES (Nintendo’s first console, originally released in 1985).
The Nintendo Switch
9. library(wordcloud)
#nintendoswitch <- searchTwitter("Nintendo Switch", n = 1000, lang = 'en')
#nintendoswitchtweets <- twListToDF(nintendoswitch)
nintendoswitchtext <- nintendoswitchtweets$text
nintendoswitchtext <- gsub("http://t.co/[a-z, A-Z, 0-9]","",nintendoswitchtext)
nintendoswitchtext <- gsub("https://t.co/[a-z, A-Z, 0-9]","",nintendoswitchtext)
Encoding(nintendoswitchtext) <- "latin1" #converts every tweet to latin1 encoding#
nintendoswitchtext <- iconv(nintendoswitchtext, from = "latin1", to = "ASCII", sub=" ")
#converts latin1 to ASCII#
nintendocorpus <- Corpus(VectorSource(nintendoswitchtext))
nintendocorpus2 <- tm_map(nintendocorpus, content_transformer(tolower), mc.cores=1)
nintendocorpus2 <- tm_map(nintendocorpus2, removeNumbers)
nintendocorpus2 <- tm_map(nintendocorpus2, removeWords, stopwords())
nintendocorpus2 <- tm_map(nintendocorpus2, removePunctuation)
nintendocorpus2 <- tm_map(nintendocorpus2, stripWhitespace)
nintendocorpus2 <- tm_map(nintendocorpus2, removeWords, "Nintendo Switch")
nintendocorpusfinal <- data.frame(text=unlist(sapply(nintendocorpus2, '[', "content")), stringsAsFactors = F
)
wordcloud(nintendocorpus2, scale=c(5,0.5), max.words = 100, #prints wordcloud
random.order = FALSE, rot.per = 0.35,
use.r.layout = FALSE, colors = brewer.pal(8,"Dark2"))
The Nintendo Switch is the company’s seventh and most recent console and is set to hit the shelves some time in March 2017. It’s set to
launch with several of the comany’s original titles among a slew of third party games including The Legend of Zelda: Breath of the Wild, The
Elder Scrolls 5: Skyrim, NBA, Splatoon and Mario Kart 8. A list of initial partner developers has already been released including third party
giants like Activision, Bethesda, and Ubisoft. With launch titles and third party contributors like these consumers are sure to have plenty of
games to choose from, which has been an issue with Nintendo’s previous consoles which lacked the hardware and power to process many
third party titles. The Nintendo company has always pushed their products towards gaming as a community or with friends and this console
is no exception. The Nintendo Switch is part home console, part portable - as the main console unit and portable screen plugs into the
Nintendo Switch Dock - and the screen can be taken on the go - instantly transitioning into a portable mode. This functionality allows players
to enjoy the hottest console games in their full glory on the go! These factors and more make it easy to see why Facebook sentiment about
the Nintendo Switch receives a lot of loves, Wows, Shares, and comments have a high rate of anticipation sentiment.
11. Nintendo’s NES Classic Edition was launched on November 11, 2016. Hordes of people eagerly awaited the launch of this miniature
throwback to the company’s premier system as they would finally be able to play 30 of their favorite Nintendo classics all packaged in a nice
convenieint 5 by 4 by 1.6 inch space for only $60! However, despite much consumer anticipation and hype for this product many customers
were left empty handed on launch day as stores everywhere were sold out of the console due to short supply. An article out of The New York
Times states, “The Classic is sold out for three reasons: Its nostalgic, its cheap and Nintendo clearly didnt ship enough of them” and,
“Nintendo has been sluggish in responding to the demand, resulting in huge markups on the secondary market, including on sites like eBay,
where the consoles were being resold for as much as $390.” Finally, “In a statement, Nintendo said that it was working hard to keep up with
consumer demand. … There will be a steady flow of additional systems through the holiday shopping season and into the new year.” These
events of course contribute to the high amount of anticipation seen in the comments on Nintendo’s Facebook page in addition to the high
amount of Angry reactions and comment sentiment.
New York Times: Nintendos New Console May Feed Your Nostalgia, if You Can Get One
The NES Classic
Final Thoughts
There’s no question that Nintendo has been one of the biggest names in gaming since its’ inception. However, the company has been
struggling to keep its’ brand identity in tact over the last several years as its’ previous consoles have simply not been able to keep up with
12. competitiors like Sony and Microsoft. Bringing back a retro console in the form of the NES Classic was the perfect way for the company to
reaffirm their identity through nostalgia and potentially make older customers interested in future Nintendo products. Although quantities of
the NES Classic were limited and opinion of the company is slightly negative at this time, the holidays aren’t over and there’s still time for
Nintendo to make up for these lost sales. As long as the company manages to restock before the holidays are over they will be fine.
Otherwise they could miss out on an important opportunity to solidify their brand identity and customer loyalty which will greatly impact the
anticipation and sales of Nintendo Switch’s upcoming release in Spring of next year.