Libraries

library('knitr')
library('markdown')
library('tidyr')
library('RCurl')
library('plyr')
library('dplyr')
library('ggplot2')

2016-05-03

Import CSV

x503 <- getURL("https://raw.githubusercontent.com/spsstudent15/Data607FinalProject/master/Tweets%20for%2005.03.2016.csv") #import twitter CSV

tweets503<- data.frame(read.csv(text=x503, header=T)) #create data frame

kable(head(tweets503,3)) #show head
X tweet city movie day Sentiment_Score
1 @iTIGERSHROFF. Just saw Baaghi movie..Its unique good action movie. Not like other bollywood movie hide and seek behind tree. Boston Baaghi 05.03.2016 0.9355539
2 BOLLYWOOD: Movie Review: Tigers mean moves apart, Baaghi is a dud https://t.co/LNEnYFtXto Boston Baaghi 05.03.2016 0.0168295
3 Review: Baaghi, a Bollywood Rebel Tale in Search of a Cause: Fists and feet fly in this movie with… https://t.co/Gv5t0tcbZr NY Times New York City Baaghi 05.03.2016 0.6880249
dim(tweets503)
## [1] 2440    6

Movie Score

moviesum503<- ddply(tweets503, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie
      
kable(moviesum503)
movie Sentiment_Score Count_of_Tweets
A Beautiful Planet 0.6871244 83
Baaghi 0.5751260 25
Dough 0.5094406 20
Eva Hesse 0.7894652 3
Green Room 0.6758744 161
Hockney 0.5284491 3
Keanu 0.6652038 1077
LAttesa (The Wait) 0.7607310 3
Men & Chicken 0.6032591 8
Mothers Day 0.6506948 362
Older Than Ireland 0.4218353 3
Pali Road 0.4949967 2
Papa: Hemingway in Cuba 0.6049819 29
Ratchet & Clank 0.6295204 482
Sacrifice 0.7101497 21
The American Side 0.7633015 2
The Family Fang 0.7413473 33
The Man Who Knew Infinity 0.8379256 31
The Meddler 0.6316935 51
Transfixed 0.8723244 1
Viktoria 0.5664273 3
Viva 0.6682436 37

Movie and City Score

moviecitysum503<- ddply(tweets503, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city
      
kable(moviecitysum503)

City Score

citysum503<- ddply(tweets503, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
      
kable(citysum503)
city Sentiment_Score Count_of_Tweets
Boston 0.6418038 102
Chicago 0.6047630 242
Denver 0.6624649 87
Houston 0.6742386 96
Lincoln 0.8345247 3
los Angeles 0.6403698 797
New Orleans 0.6383094 86
New York City 0.6789346 855
Seattle 0.6545303 104
St. Louis 0.7729804 68

Unique Movies

allmovies503<-unique(tweets503[c("movie")]) # get unique movies
allmovies503$num<-seq.int(nrow(allmovies503)) # add counter row
kable(allmovies503) #show unique values for movie name
movie num
1 Baaghi 1
26 Keanu 2
1103 The American Side 3
1105 Pali Road 4
1107 Papa: Hemingway in Cuba 5
1136 Dough 6
1156 The Family Fang 7
1189 The Man Who Knew Infinity 8
1220 Viva 9
1257 Mothers Day 10
1619 LAttesa (The Wait) 11
1622 Older Than Ireland 12
1625 A Beautiful Planet 13
1708 Ratchet & Clank 14
2190 Viktoria 15
2193 Transfixed 16
2194 Sacrifice 17
2215 Eva Hesse 18
2218 Men & Chicken 19
2226 Hockney 20
2229 The Meddler 21
2280 Green Room 22

Graphs

ggplot(
  moviesum503, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum503, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

2016-05-04

Import CSV

x504 <- getURL("https://raw.githubusercontent.com/spsstudent15/Data607FinalProject/master/Tweets%20for%2005.04.2016.csv") #import twitter CSV

tweets504<- data.frame(read.csv(text=x504, header=T)) #create data frame

kable(head(tweets504,3)) #show head
X tweet city movie day Sentiment_Score
1 RT @PeteBlackburn: Somehow Keanu, a movie about fake gangsters trying to rescue a kitten, was stupider than I expected Boston Keanu 05.04.2016 0.0813694
2 Somehow Keanu, a movie about fake gangsters trying to rescue a kitten, was stupider than I expected Boston Keanu 05.04.2016 0.0937185
3 Keanu = Not Your Average Buddy Action Film: The AHH movie review of “Keanu” starring Keegan-Michael Key, Jo… https://t.co/SYtkk6Q98L New York City Keanu 05.04.2016 0.7579466
#dim(tweets504)

Movie Score

moviesum504<- ddply(tweets504, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie
kable(moviesum504)
movie Sentiment_Score Count_of_Tweets
A Beautiful Planet 0.9350566 1
Green Room 0.6911169 26
Keanu 0.7724452 69
Men & Chicken 0.8554496 1
Mothers Day 0.7642735 41
Older Than Ireland 0.3211677 1
Papa: Hemingway in Cuba 0.4434618 6
Ratchet & Clank 0.6825581 23
Sacrifice 0.6979232 2
The Family Fang 0.8095837 1
The Man Who Knew Infinity 0.9880090 1
The Meddler 0.6949428 6
Viktoria 0.3375587 1
Viva 0.5055177 5

Movie and City Score

moviecitysum504<- ddply(tweets504, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city
kable(moviecitysum504)

City Score

citysum504<- ddply(tweets504, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
kable(citysum504)
city Sentiment_Score Count_of_Tweets
Boston 0.2904943 6
Chicago 0.6850258 13
Denver 0.7473017 11
Houston 0.7808763 7
Los Angeles 0.6956255 53
New Orleans 0.6497442 2
New York City 0.7706122 81
Seattle 0.3175780 2
St. Louis 0.8605957 9

Unique Movies

allmovies504<-unique(tweets504[c("movie")]) # get unique movies
allmovies504$num<-seq.int(nrow(allmovies504)) # add counter row
kable(allmovies504) #show unique values for movie name
movie num
1 Keanu 1
70 Papa: Hemingway in Cuba 2
76 The Family Fang 3
77 The Man Who Knew Infinity 4
78 Viva 5
83 Mothers Day 6
124 Older Than Ireland 7
125 A Beautiful Planet 8
126 Ratchet & Clank 9
149 Viktoria 10
150 Sacrifice 11
152 Men & Chicken 12
153 The Meddler 13
159 Green Room 14

Graphs

ggplot(
  moviesum504, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum504, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

2016-05-05

Import CSV

x505 <- getURL("https://raw.githubusercontent.com/spsstudent15/Data607FinalProject/master/Tweets%20for%2005.05.2016.csv") #import twitter CSV

tweets505<- data.frame(read.csv(text=x505, header=T)) #create data frame

kable(head(tweets505,3)) #show head
X tweet city movie day Sentiment_Score
1 Movie Review: Keanu https://t.co/0GCZyi7rdy https://t.co/O6HjwlBaA5 Boston Keanu 05.05.2016 0.9367028
2 RT @PeteBlackburn: Somehow Keanu, a movie about fake gangsters trying to rescue a kitten, was stupider than I expected Boston Keanu 05.05.2016 0.0813694
3 RT @Tribeca: Key and Peele’s subversive intelligence powers the comedy duo’s gleefully-absurd #KEANU. https://t.co/EKnyjGUklc https://t.co/ New York City Keanu 05.05.2016 0.3208861
#dim(tweets505)

Movie Score

moviesum505<- ddply(tweets505, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie
kable(moviesum505)
movie Sentiment_Score Count_of_Tweets
A Beautiful Planet 0.9702582 6
Dough 0.6558193 1
Eva Hesse 0.9344939 1
Green Room 0.6873747 20
Keanu 0.5245778 33
Men & Chicken 0.8554496 1
Mothers Day 0.7285004 30
Ratchet & Clank 0.6738906 14
Sacrifice 0.7061121 2
The Family Fang 0.8059055 7
The Man Who Knew Infinity 0.9051434 2
The Meddler 0.8200938 4
Viva 0.7874603 3

Movie and City Score

moviecitysum505<- ddply(tweets505, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city
kable(moviecitysum505)

City Score

citysum505<- ddply(tweets505, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
kable(citysum505)
city Sentiment_Score Count_of_Tweets
Boston 0.5593184 7
Chicago 0.7237302 14
Denver 0.8007684 1
Houston 0.8031522 10
Los Angeles 0.6393636 41
New Orleans 0.3105057 1
New York City 0.6979320 42
Seattle 0.8005825 8

Unique Movies

allmovies505<-unique(tweets505[c("movie")]) # get unique movies
allmovies505$num<-seq.int(nrow(allmovies505)) # add counter row
kable(allmovies505) #show unique values for movie name
movie num
1 Keanu 1
34 Dough 2
35 The Family Fang 3
42 The Man Who Knew Infinity 4
44 Viva 5
47 Mothers Day 6
77 A Beautiful Planet 7
83 Ratchet & Clank 8
97 Sacrifice 9
99 Eva Hesse 10
100 Men & Chicken 11
101 The Meddler 12
105 Green Room 13

Graphs

ggplot(
  moviesum505, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum505, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

2016-05-06

Import CSV

x506 <- getURL("https://raw.githubusercontent.com/spsstudent15/Data607FinalProject/master/Tweets%20for%2005.06.2016.csv") #import twitter CSV
tweets506<- data.frame(read.csv(text=x506, header=T)) #create data frame
kable(head(tweets506,3)) #show head
X tweet city movie day Sentiment_Score
1 I gotta write something on Tiger. When I came out of #Baaghi I knew movie would do well&his star power would grow. Why everyone surprised?? New York City Baaghi 05.06.2016 0.5727997
2 WATCH BAAGHI 2016 MOVIE ONLINE FORFREE https://t.co/6xOPr0jH39 Seattle Baaghi 05.06.2016 0.2353356
3 @WahooFX Been checking out Key and Peele after seeing their movie, Keanu. Very clever writing. Funny guys. New York City Keanu 05.06.2016 0.8883232
#dim(tweets506)

Movie Score

moviesum506<- ddply(tweets506, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie
kable(moviesum506)
movie Sentiment_Score Count_of_Tweets
A Beautiful Planet 0.9057405 2
Baaghi 0.4040677 2
Dough 0.5768954 1
Green Room 0.6289183 12
Keanu 0.7635731 43
Men & Chicken 0.8929113 1
Mothers Day 0.7848442 38
Older Than Ireland 0.2630552 1
Ratchet & Clank 0.6356453 14
The Family Fang 0.4418001 1
The Man Who Knew Infinity 0.9159938 1
The Meddler 0.3039157 7
Viktoria 0.4310602 1
Viva 0.4730699 1

Movie and City Score

moviecitysum506<- ddply(tweets506, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city
kable(moviecitysum506)

City Score

citysum506<- ddply(tweets506, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
kable(citysum506)
city Sentiment_Score Count_of_Tweets
Boston 0.6107696 2
Chicago 0.7487589 9
Denver 0.7819757 4
Houston 0.6600502 8
Lincoln 0.0756081 1
Los Angeles 0.6522764 46
New Orleans 0.7454275 3
New York City 0.7753619 46
Seattle 0.5683229 5
St. Louis 0.6520504 1

Unique Movies

allmovies506<-unique(tweets506[c("movie")]) # get unique movies
allmovies506$num<-seq.int(nrow(allmovies506)) # add counter row
kable(allmovies506) #show unique values for movie name
movie num
1 Baaghi 1
3 Keanu 2
46 Dough 3
47 The Family Fang 4
48 The Man Who Knew Infinity 5
49 Viva 6
50 Mothers Day 7
88 Older Than Ireland 8
89 A Beautiful Planet 9
91 Ratchet & Clank 10
105 Viktoria 11
106 Men & Chicken 12
107 The Meddler 13
114 Green Room 14

Graphs

ggplot(
  moviesum506, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum506, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

2016-05-07

Import CSV

x507 <- getURL("https://raw.githubusercontent.com/spsstudent15/Data607FinalProject/master/Tweets%20for%2005.07.2016.csv") #import twitter CSV
tweets507<- data.frame(read.csv(text=x507, header=T)) #create data frame
kable(head(tweets507,3)) #show head
X tweet city movie day Sentiment_Score
1 RT @ScreenMediaFilm: Head to @FandangoNOW and rent or buy #MothersAndDaughters, a perfect #MothersDay gift - https://t.co/DP9dXEoqnq https: New York City Mothers and Daughters 05.07.2016 0.6272798
2 RT @ScreenMediaFilm: Right now! You can see a star-studded cast in #MothersAndDaughters on @iTunesMovies and in theaters! https://t.co/ExHC New York City Mothers and Daughters 05.07.2016 0.3594603
3 RT @ScreenMediaFilm: #MothersAndDaughters w/ @sharonstone @SusanSarandon@CourteneyCox @ChristinaRicci & more! https://t.co/ExHCyXv4CO http New York City Mothers and Daughters 05.07.2016 0.6668710
#dim(tweets507)

Movie Score

moviesum507<- ddply(tweets507, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie
kable(moviesum507)
movie Sentiment_Score Count_of_Tweets
A Bigger Splash 0.5600869 27
A Hologram for the King 0.5971608 2
Baaghi 0.8501134 2
Being Charlie 0.6279919 12
Captain America: Civil War 0.7918589 661
Dark Horse 0.6029846 15
Dough 0.5761869 2
Elstree 1976 0.7597740 13
Elvis & Nixon 0.9997645 1
Green Room 0.5129880 6
Keanu 0.7290294 91
Men & Chicken 0.9700285 1
Mother’s Day 0.7051047 60
Mothers Day 0.7051047 60
Mothers and Daughters 0.7088384 17
Nina 0.6235115 9
Papa: Hemingway in Cuba 0.3656186 3
Ratchet & Clank 0.4689717 17
Sin Alas 0.2390684 1
The Family Fang 0.6779906 7
The Man Who Knew Infinity 0.9392011 4
The Meddler 0.4545197 6
The Offering 0.5217223 4
Those People 0.2774711 2
Viva 0.8058549 8

Movie and City Score

moviecitysum507<- ddply(tweets507, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city
kable(moviecitysum507)

City Score

citysum507<- ddply(tweets507, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
kable(citysum507)
city Sentiment_Score Count_of_Tweets
Boston 0.7584916 39
Chicago 0.7521585 100
Denver 0.8490543 28
Houston 0.8431351 64
Lincoln 0.7778615 4
Los Angeles 0.7291199 304
New Orleans 0.9677572 2
New York City 0.7293779 419
Seattle 0.7912599 41
St. Louis 0.8351642 30

Unique Movies

allmovies507<-unique(tweets507[c("movie")]) # get unique movies
allmovies507$num<-seq.int(nrow(allmovies507)) # add counter row
kable(allmovies507) #show unique values for movie name
movie num
1 Mothers and Daughters 1
18 Elstree 1976 2
31 Those People 3
33 Being Charlie 4
45 The Offering 5
49 Dark Horse 6
64 Captain America: Civil War 7
725 A Bigger Splash 8
752 Baaghi 9
754 The Family Fang 10
761 The Man Who Knew Infinity 11
765 Dough 12
767 Mothers Day 13
827 Papa: Hemingway in Cuba 14
830 Ratchet & Clank 15
847 Viva 16
855 Keanu 17
946 Men & Chicken 18
947 Nina 19
956 Elvis & Nixon 20
957 A Hologram for the King 21
959 The Meddler 22
965 Green Room 23
971 Sin Alas 24
972 Mother’s Day 25

Graphs

ggplot(
  moviesum507, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum507, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

2016-05-08

Import CSV

x508 <- getURL("https://raw.githubusercontent.com/spsstudent15/Data607FinalProject/master/Tweets%20for%2005.08.2016.csv") #import twitter CSV
tweets508<- data.frame(read.csv(text=x508, header=T)) #create data frame
kable(head(tweets508,3)) #show head
X tweet city movie day Sentiment_Score
1 RT @ScreenMediaFilm: We’re about to crack the top #25 overall on @iTunesMovies - Help #MothersAndDaughters climb to #1 for Mother’s Day! ht New York City Mothers and Daughters 05.08.2016 0.2088123
2 RT @ScreenMediaFilm: Want a movie that’s PERFECT for this weekend? Go see #MothersAndDaughters right now in theaters, or on demand https:// New York City Mothers and Daughters 05.08.2016 0.9672440
3 RT @ashanti: Had a blast with these lovely ladies at the premier for our movie “Mothers and daughters” last https://t.co/O78xXq7CHY New York City Mothers and Daughters 05.08.2016 0.9560200
#dim(tweets508)

Movie Score

moviesum508<- ddply(tweets508, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie
kable(moviesum508)
movie Sentiment_Score Count_of_Tweets
A Beautiful Planet 0.9350566 1
A Bigger Splash 0.5229955 13
Baaghi 0.7681713 2
Being Charlie 0.6543891 4
Captain America: Civil War 0.7709729 506
Dark Horse 0.8021627 9
Dough 0.6988977 1
Elstree 1976 0.7146252 1
Elvis & Nixon 0.4100779 2
Green Room 0.6480975 13
Keanu 0.6793276 31
Mother’s Day 0.7164618 55
Mothers Day 0.7164618 55
Mothers and Daughters 0.6826797 20
Nina 0.7713823 3
Papa: Hemingway in Cuba 0.9939506 1
Ratchet & Clank 0.4775937 18
Sin Alas 0.3109672 1
The Family Fang 0.3585073 1
The Man Who Knew Infinity 0.8913501 2
The Meddler 0.7348663 6
The Offering 0.3625898 2
Those People 0.2172879 2
Viva 0.0386368 1

Movie and City Score

moviecitysum508<- ddply(tweets508, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city
kable(moviecitysum508)

City Score

citysum508<- ddply(tweets508, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
kable(citysum508)
city Sentiment_Score Count_of_Tweets
Boston 0.7890522 22
Chicago 0.8017514 81
Denver 0.7297705 13
Houston 0.7761848 51
Lincoln 0.7279522 4
Los Angeles 0.7365210 215
New Orleans 0.7919442 3
New York City 0.7113340 325
Seattle 0.7223629 24
St. Louis 0.8194414 12

Unique Movies

allmovies508<-unique(tweets508[c("movie")]) # get unique movies
allmovies508$num<-seq.int(nrow(allmovies508)) # add counter row
kable(allmovies508) #show unique values for movie name
movie num
1 Mothers and Daughters 1
21 Elstree 1976 2
22 Those People 3
24 Being Charlie 4
28 The Offering 5
30 Dark Horse 6
39 Captain America: Civil War 7
545 A Bigger Splash 8
558 Baaghi 9
560 The Family Fang 10
561 The Man Who Knew Infinity 11
563 A Beautiful Planet 12
564 Dough 13
565 Mothers Day 14
620 Papa: Hemingway in Cuba 15
621 Ratchet & Clank 16
639 Viva 17
640 Keanu 18
671 Nina 19
674 Elvis & Nixon 20
676 The Meddler 21
682 Green Room 22
695 Sin Alas 23
696 Mother’s Day 24

Graphs

ggplot(
  moviesum508, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum508, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

2016-05-09

Import CSV

x509 <- getURL("https://raw.githubusercontent.com/spsstudent15/Data607FinalProject/master/Tweets%20for%2005.09.2016.csv") #import twitter CSV
tweets509<- data.frame(read.csv(text=x509, header=T)) #create data frame
kable(head(tweets509,3)) #show head
X tweet city movie day Sentiment_Score
1 Movie Review “A Bigger Splash” starring Tilda Swinton https://t.co/YEbptbaJ4D New York City A Bigger Splash 05.09.2016 0.5507142
2 #MovieReview #ABiggerSplash https://t.co/Ko8w27wKSl New York City A Bigger Splash 05.09.2016 0.7435926
3 Movie Review #ABiggerSplash https://t.co/Ko8w27wKSl New York City A Bigger Splash 05.09.2016 0.8097688
#dim(tweets509)

Movie Score

moviesum509<- ddply(tweets509, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie
kable(moviesum509)
movie Sentiment_Score Count_of_Tweets
A Bigger Splash 0.4746252 11
A Hologram for the King 0.9617668 2
Being Charlie 0.6191784 1
Captain America: Civil War 0.7881106 341
Dark Horse 0.6027937 7
Dough 0.7110656 6
Green Room 0.6466214 7
Keanu 0.7147022 29
Mother’s Day 0.8105354 168
Mothers Day 0.8118599 171
Mothers and Daughters 0.6822596 17
Nina 0.6317530 2
Papa: Hemingway in Cuba 0.0426757 1
Ratchet & Clank 0.6268841 9
The Family Fang 0.6941836 2
The Meddler 0.8436882 9
The Offering 0.0311026 1
Those People 0.6523616 4
Viva 0.6154339 3

Movie and City Score

moviecitysum509<- ddply(tweets509, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city
kable(moviecitysum509)

City Score

citysum509<- ddply(tweets509, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
kable(citysum509)
city Sentiment_Score Count_of_Tweets
Boston 0.6588172 29
Chicago 0.7317200 67
Denver 0.9195068 21
Houston 0.8627062 48
Los Angeles 0.7929957 268
New Orleans 0.7915382 2
New York City 0.7670166 308
Seattle 0.7480922 34
St. Louis 0.9020215 14

Unique Movies

allmovies509<-unique(tweets509[c("movie")]) # get unique movies
allmovies509$num<-seq.int(nrow(allmovies509)) # add counter row
kable(allmovies509) #show unique values for movie name
movie num
1 A Bigger Splash 1
12 A Hologram for the King 2
14 Being Charlie 3
15 Captain America: Civil War 4
356 Dark Horse 5
363 Dough 6
369 Green Room 7
376 Keanu 8
405 Mothers Day 9
576 Mothers and Daughters 10
593 Nina 11
595 Papa: Hemingway in Cuba 12
596 Ratchet & Clank 13
605 The Offering 14
606 The Family Fang 15
608 The Meddler 16
617 Those People 17
621 Viva 18
624 Mother’s Day 19

Graphs

ggplot(
  moviesum509, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum509, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

All Days Combined

tweets1<- rbind(tweets503,tweets504,tweets505,tweets506,tweets507,tweets508, tweets509)

write.csv(tweets1, file = "tweets503to509.csv")


#kable(head(tweets1))
#kable(tail(tweets1))
#dim(tweets1)

Movie Score

moviesum1<- ddply(tweets1, .(movie), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by movie

moviesum1$movie<-as.character(moviesum1$movie)
moviesum1<- arrange(moviesum1, movie)

moviesum1$num<-seq.int(nrow(moviesum1)) # add counter row

dim(moviesum1)
## [1] 35  4
str(moviesum1)
## 'data.frame':    35 obs. of  4 variables:
##  $ movie          : chr  "A Beautiful Planet" "A Bigger Splash" "A Hologram for the King" "Baaghi" ...
##  $ Sentiment_Score: num  0.715 0.532 0.779 0.594 0.634 ...
##  $ Count_of_Tweets: int  93 51 4 31 17 1508 31 31 14 3 ...
##  $ num            : int  1 2 3 4 5 6 7 8 9 10 ...
kable(moviesum1)
movie Sentiment_Score Count_of_Tweets num
A Beautiful Planet 0.7154244 93 1
A Bigger Splash 0.5321993 51 2
A Hologram for the King 0.7794638 4 3
Baaghi 0.5942856 31 4
Being Charlie 0.6336846 17 5
Captain America: Civil War 0.7840031 1508 6
Dark Horse 0.6607674 31 7
Dough 0.5657804 31 8
Elstree 1976 0.7565491 14 9
Elvis & Nixon 0.6066401 3 10
Eva Hesse 0.8257224 4 11
Green Room 0.6698322 245 12
Hockney 0.5284491 3 13
Keanu 0.6758887 1373 14
LAttesa (The Wait) 0.7607310 3 15
Men & Chicken 0.6999926 12 16
Mother’s Day 0.7698998 283 17
Mothers Day 0.7121606 757 18
Mothers and Daughters 0.6907826 54 19
Nina 0.6563754 14 20
Older Than Ireland 0.3699457 5 21
Pali Road 0.4949967 2 22
Papa: Hemingway in Cuba 0.5584682 40 23
Ratchet & Clank 0.6233490 577 24
Sacrifice 0.7088486 25 25
Sin Alas 0.2750178 2 26
The American Side 0.7633015 2 27
The Family Fang 0.7278845 52 28
The Man Who Knew Infinity 0.8592558 41 29
The Meddler 0.6350935 89 30
The Offering 0.4061673 7 31
Those People 0.4498706 8 32
Transfixed 0.8723244 1 33
Viktoria 0.4935801 5 34
Viva 0.6624109 58 35

Movie and City Score

moviecitysum1<- ddply(tweets1, .(movie, city), summarize,  Sentiment_Score=mean(Sentiment_Score)) #summarize by movie and city

kable(moviecitysum1)

City Score

citysum1<- ddply(tweets1, .(city), summarize,  Sentiment_Score=mean(Sentiment_Score), Count_of_Tweets=length(tweet)) #summarize by city
kable(citysum1)
city Sentiment_Score Count_of_Tweets
Boston 0.6685495 207
Chicago 0.6869049 526
Denver 0.7415370 165
Houston 0.7692286 284
Lincoln 0.7168697 12
los Angeles 0.6403698 797
New Orleans 0.6528819 99
New York City 0.7133538 2076
Seattle 0.7025967 218
St. Louis 0.8095269 134
Los Angeles 0.7396053 927

Graphs

ggplot(
  moviesum1, aes(x = reorder(movie,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("Movie Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="Movies",y="Score")

ggplot(
  citysum1, aes(x = reorder(city,Sentiment_Score), y = Sentiment_Score, fill=Sentiment_Score)) + 
  geom_bar(stat="identity") +
  ggtitle("City Average Sentiment Score")+ 
  theme(axis.text=element_text(angle=90))+
  labs(x="City",y="Score")

Statistics

Totals

dim(tweets1)
## [1] 5445    6
dim(allmovies1)
## [1] 35  2

Tweet Count Per Day

dim(tweets503)
## [1] 2440    6
dim(tweets504)
## [1] 184   6
dim(tweets505)
## [1] 124   6
dim(tweets506)
## [1] 125   6
dim(tweets507)
## [1] 1031    6
dim(tweets508)
## [1] 750   6
dim(tweets509)
## [1] 791   6

Movie Count Per Day

dim(allmovies503)
## [1] 22  2
dim(allmovies504)
## [1] 14  2
dim(allmovies505)
## [1] 13  2
dim(allmovies506)
## [1] 14  2
dim(allmovies507)
## [1] 25  2
dim(allmovies508)
## [1] 24  2
dim(allmovies509)
## [1] 19  2