For my twitter project I decided to look at tweets pertaining to the Boston Celtics, a basketball team that plays in the NBA. The following chart and tables aim to give a general idea of the twitter universe’s opinion on the team and look at popular tweets. The key word that will be used is #CUsRise. This is the hashtag that the team uses on twitter and is used exclusively to talk about the Celtics. This will help make sure that we are looking at tweets talking about the Celtics basketball team and no other uses than referring to them. This graph looks at the sentiment analysis of the tweets and is useful to get a gage of the overall mood of the twitter public opinion by looking at.
num_tweets <- 2500
c <-searchTwitteR('CUsRise', n= num_tweets, since = '2018-11-01')
c_df <- twListToDF(c)
reg <- "([^A-Za-z\\d#@']|'(?![A-Za-z\\d#@]))"
c_words <- c_df %>%
filter(!str_detect(text, '^"')) %>%
mutate(text = str_replace_all(text, "https://t.co/[A-Za-z\\d]+|&", "")) %>%
unnest_tokens(word, text, token = "regex", pattern = reg) %>%
filter(!word %in% stop_words$word,
str_detect(word, "[a-z]"))
nrc <- sentiments %>%
filter(lexicon == "nrc") %>%
select(word, sentiment)
c_words_sentiments <- c_words %>% inner_join(nrc, by = "word")
c_graph <-c_words_sentiments %>% group_by(sentiment) %>% summarize(n = n()) %>% arrange(desc(n))
ggplot(c_graph, aes(x= sentiment, y= n))+ geom_bar(stat = "identity", fill= "lightgreen" )+ theme_minimal()+ labs(
y= "count",
title= "Twitter feelings toward the Celtics"
)+ scale_y_continuous(limits = c(0,350), breaks= c(0,50,100,150,200,250,300,350,400,450,500))
The Celtics have had a rough start to their season with a 11-10 record (at the time of writing) so a high negative reaction is logical and anyone who has been following them would expect it. It would also be natural to have a high negative sentiment after a loss as well and to have a higher positive sentiment after a big win. Now let’s look at some of the most popular tweets with the Celtics hashtag.
The table below will look at the top favorited tweets.
c_df_top_favorite <-head(c_df %>% select(text, favoriteCount, screenName) %>% arrange(desc(favoriteCount)),10)
kable (c_df_top_favorite) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
| text | favoriteCount | screenName |
|---|---|---|
| Kyrie Irving records 26 PTS, 10 ASTS, 5 STLS in New Orleans! #CUsRise https://t.co/za5AwARBjo | 2920 | NBA |
| Kyrie Irving records 26 PTS, 10 ASTS, 5 STLS in New Orleans! #CUsRise https://t.co/za5AwARBjo | 2051 | NBA |
|
Jayson Tatum (20 PTS, 7 REBS) closes the game out with this slam! Final in New Orleans: #CUsRise 124 #DoItBig 107 https://t.co/OEUH0i2kCO |
577 | NBA |
|
Tatum has been very consistent (20 PTS, 7 REB) in his sophomore season. #CUsRise https://t.co/zCUXNqiVKx |
543 | NBATV |
|
Scary Terry before the buzzer! #CUsRise https://t.co/Sj5LUF2C8B |
255 | NBATV |
|
Uncle Drew (26 PTS, 10 AST) led the Celtics to a road win against the Pelicans! #CUsRise https://t.co/uMMh6LsHDv |
235 | NBATV |
|
@KyrieIrving comeu a bola na vitória dos @Celtics (26 PTS e 10 AST) em Nova Orleans! #CUsRise https://t.co/edbCT4Q7dq |
180 | NBABrasil |
|
Kyrie Irving en la victoria de Boston Celtics ante New Orleans Pelicans: 26 puntos 10 asistencias 5 robos #CUsRise https://t.co/hj2ZyIJ4Yk |
171 | Pasion_Basket1 |
| Hell yeah #CUsRise | 151 | AnnaHorford |
|
¡26 puntos, 10 asistencias y 5 robos para @KyrieIrving en el triunfo de los @celtics ante los Pelicans! #CUsRise https://t.co/ec5P7HhJFD |
100 | NBALatam |
Looking at the top tweets they seem to be mostly highlight clips with some more text based tweets closer to the bottom. This makes sense as twitter is good platform to post small video clips more specifically highlights.
c_df_top_retweet <-head(c_df %>% filter(isRetweet== FALSE) %>% select(text,retweetCount,screenName) %>% arrange(desc(retweetCount)),10)
kable(c_df_top_retweet)%>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
| text | retweetCount | screenName |
|---|---|---|
| Kyrie Irving records 26 PTS, 10 ASTS, 5 STLS in New Orleans! #CUsRise https://t.co/za5AwARBjo | 679 | NBA |
| Kyrie Irving records 26 PTS, 10 ASTS, 5 STLS in New Orleans! #CUsRise https://t.co/za5AwARBjo | 387 | NBA |
|
Jayson Tatum (20 PTS, 7 REBS) closes the game out with this slam! Final in New Orleans: #CUsRise 124 #DoItBig 107 https://t.co/OEUH0i2kCO |
157 | NBA |
|
Tatum has been very consistent (20 PTS, 7 REB) in his sophomore season. #CUsRise https://t.co/zCUXNqiVKx |
83 | NBATV |
|
Scary Terry before the buzzer! #CUsRise https://t.co/Sj5LUF2C8B |
61 | NBATV |
|
Uncle Drew (26 PTS, 10 AST) led the Celtics to a road win against the Pelicans! #CUsRise https://t.co/uMMh6LsHDv |
56 | NBATV |
|
Kyrie Irving en la victoria de Boston Celtics ante New Orleans Pelicans: 26 puntos 10 asistencias 5 robos #CUsRise https://t.co/hj2ZyIJ4Yk |
41 | Pasion_Basket1 |
| Our general sports podcast is ready and waiting for you guys! https://t.co/c9YAtvH4KN available on iTunes, stitcher https://t.co/MJZ4Vi4szT | 17 | celtics_pulse |
| #Autographed #TomBrady #Patriots #SuperBowl (51) 16x20 “SCREAM” Photo-(Tristar/LOA) @ ONLY $810! #AUCTION ENDS TONI https://t.co/Xalypo0UaX | 15 | SportsDen2016 |
| OUR #TEN @Ebay #ThanksgivingWeekend #AUCTIONS W/NO RESERVES END TONIGHT WED 11/27 BETWEEN 9-10pm! #Brady #Tatum https://t.co/X8kS2RRJSB | 15 | Limited66702616 |
Here we can see some of the most recent top retweeted tweets. Not surprisingly the NBA accounts have the most retweets because their tweets get much more exposure than the average twitter user.
c_df_top_name <-head(c_df %>% group_by(screenName) %>% summarize(n=n()) %>% arrange(desc(n)),10)
kable(c_df_top_name)%>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
| screenName | n |
|---|---|
| CelticsPlacar | 95 |
| Celtics_Brasil | 64 |
| Luckasguns | 48 |
| BlackOut1000000 | 39 |
| CelticsForeve11 | 30 |
| CelticsLead | 28 |
| SportsDen2016 | 27 |
| victorpfff | 27 |
| __haganeno | 18 |
| Limited66702616 | 16 |
Here are some of the most active tweeters using the #CUsRise hashtag. Interestingly it seems that the top two accounts are both from Brazil.
Most of the tables and the graphs in this project are pretty self-explanatory. I found this unit interesting and wonder how often tweets are taken an used by companies for various types of analysis. I think that the sentimental analysis is the most interesting part of the project/twitter unit and can see how companies might use it to get an overview of the reaction to one of their products or the company as a whole. There is also the possibilities of seeing how a competitor’s product is viewed over twitter. They also probably could do analysis on various other forms of social media with open API’s.