# setwd('~/Projects/Personal/MovieNight')
setwd('~/Projects/MovieNight')
library(tidyverse)
library(lubridate)
# library(AfterSl1p)
devtools::load_all('~/Work/Projects/aftersl1p')
theme_set(theme_bw())
cols = c('#878787','#FDDBC7','#B2182B')
ranklevs = c('I would NOT come to watch this film',
'I do not love this film but would still show up',
'I would REALLY LIKE to watch this film')
make_rank = function(x){
x = factor(x, levels = ranklevs)
x = as.numeric(x) -2
return(x)
}
The voting data are available as a .csv file here.
dat = read.csv('data/current_week.csv', stringsAsFactors = FALSE, header = FALSE)
datm = as.matrix(dat)
tdf = read.csv('data/current_movies.csv', row.names = 1, header = FALSE,
stringsAsFactors = FALSE)
titles = tdf[[1]]
titles
## [1] "Timestamp" "AMightyWind" "GoodDayDieHard" "HarryAndersons"
## [5] "SausageParty" "Untouchables" "PinkPanther" "BadTimesElRoyale"
## [9] "Willow"
names(titles) = c(rownames(tdf))
titles
## Timestamp
## "Timestamp"
## [A Mighty Wind (2003, 1:32)]
## "AMightyWind"
## [A Good Day to Die Hard (2013, 1:41)]
## "GoodDayDieHard"
## [Harry and the Hendersons (1987, 1:51)]
## "HarryAndersons"
## [Sausage Party (2016, 1:29)]
## "SausageParty"
## [The Untouchables (1987, 1:59)]
## "Untouchables"
## [The Pink Panther (1963, 1:55)]
## "PinkPanther"
## [Bad Times at the El Royale (2018, 2:22)]
## "BadTimesElRoyale"
## [Willow (1988, 2:06)]
## "Willow"
datm[datm %in% names(titles)] = titles[datm[datm %in% names(titles)]]
datm
## V1
## [1,] "Timestamp"
## [2,] "2024/12/14 3:47:24 p.m. EST"
## [3,] "2024/12/14 3:52:19 p.m. EST"
## [4,] "2024/12/14 3:59:50 p.m. EST"
## [5,] "2024/12/14 4:11:19 p.m. EST"
## [6,] "2024/12/14 4:56:01 p.m. EST"
## [7,] "2024/12/15 4:53:20 p.m. EST"
## [8,] "2024/12/15 5:50:34 p.m. EST"
## [9,] "2024/12/15 5:51:13 p.m. EST"
## [10,] "2024/12/15 8:50:50 p.m. EST"
## [11,] "2024/12/16 9:08:07 a.m. EST"
## [12,] "2024/12/16 11:50:54 a.m. EST"
## [13,] "2024/12/16 11:55:25 a.m. EST"
## [14,] "2024/12/16 11:57:26 a.m. EST"
## [15,] "2024/12/16 11:58:19 a.m. EST"
## [16,] "2024/12/16 1:22:52 p.m. EST"
## [17,] "2024/12/16 4:31:03 p.m. EST"
## [18,] "2024/12/16 4:42:59 p.m. EST"
## V2
## [1,] "AMightyWind"
## [2,] "I would REALLY LIKE to watch this film"
## [3,] "I do not love this film but would still show up"
## [4,] "I would REALLY LIKE to watch this film"
## [5,] "I would REALLY LIKE to watch this film"
## [6,] "I would REALLY LIKE to watch this film"
## [7,] "I would NOT come to watch this film"
## [8,] "I do not love this film but would still show up"
## [9,] "I would NOT come to watch this film"
## [10,] "I do not love this film but would still show up"
## [11,] "I do not love this film but would still show up"
## [12,] "I would NOT come to watch this film"
## [13,] "I would NOT come to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I do not love this film but would still show up"
## [16,] "I would NOT come to watch this film"
## [17,] "I do not love this film but would still show up"
## [18,] "I would REALLY LIKE to watch this film"
## V3
## [1,] "GoodDayDieHard"
## [2,] "I would REALLY LIKE to watch this film"
## [3,] "I do not love this film but would still show up"
## [4,] "I would REALLY LIKE to watch this film"
## [5,] "I do not love this film but would still show up"
## [6,] "I would NOT come to watch this film"
## [7,] "I would REALLY LIKE to watch this film"
## [8,] "I would NOT come to watch this film"
## [9,] "I would NOT come to watch this film"
## [10,] "I would NOT come to watch this film"
## [11,] "I would REALLY LIKE to watch this film"
## [12,] "I would REALLY LIKE to watch this film"
## [13,] "I would REALLY LIKE to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I would REALLY LIKE to watch this film"
## [16,] "I would NOT come to watch this film"
## [17,] "I would REALLY LIKE to watch this film"
## [18,] "I would REALLY LIKE to watch this film"
## V4
## [1,] "HarryAndersons"
## [2,] "I would REALLY LIKE to watch this film"
## [3,] "I do not love this film but would still show up"
## [4,] "I do not love this film but would still show up"
## [5,] "I do not love this film but would still show up"
## [6,] "I would REALLY LIKE to watch this film"
## [7,] "I would NOT come to watch this film"
## [8,] "I would NOT come to watch this film"
## [9,] "I would NOT come to watch this film"
## [10,] "I do not love this film but would still show up"
## [11,] "I do not love this film but would still show up"
## [12,] "I do not love this film but would still show up"
## [13,] "I would NOT come to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I do not love this film but would still show up"
## [16,] "I would NOT come to watch this film"
## [17,] "I do not love this film but would still show up"
## [18,] "I do not love this film but would still show up"
## V5
## [1,] "SausageParty"
## [2,] "I would REALLY LIKE to watch this film"
## [3,] "I do not love this film but would still show up"
## [4,] "I would REALLY LIKE to watch this film"
## [5,] "I would NOT come to watch this film"
## [6,] "I do not love this film but would still show up"
## [7,] "I would NOT come to watch this film"
## [8,] "I would NOT come to watch this film"
## [9,] "I would REALLY LIKE to watch this film"
## [10,] "I do not love this film but would still show up"
## [11,] "I would NOT come to watch this film"
## [12,] "I would NOT come to watch this film"
## [13,] "I would NOT come to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I would NOT come to watch this film"
## [16,] "I would NOT come to watch this film"
## [17,] "I would NOT come to watch this film"
## [18,] "I do not love this film but would still show up"
## V6
## [1,] "Untouchables"
## [2,] "I would REALLY LIKE to watch this film"
## [3,] "I do not love this film but would still show up"
## [4,] "I would REALLY LIKE to watch this film"
## [5,] "I would REALLY LIKE to watch this film"
## [6,] "I would REALLY LIKE to watch this film"
## [7,] "I would NOT come to watch this film"
## [8,] "I do not love this film but would still show up"
## [9,] "I would NOT come to watch this film"
## [10,] "I do not love this film but would still show up"
## [11,] "I do not love this film but would still show up"
## [12,] "I would NOT come to watch this film"
## [13,] "I would NOT come to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I would REALLY LIKE to watch this film"
## [16,] "I do not love this film but would still show up"
## [17,] "I do not love this film but would still show up"
## [18,] "I do not love this film but would still show up"
## V7
## [1,] "PinkPanther"
## [2,] "I would REALLY LIKE to watch this film"
## [3,] "I do not love this film but would still show up"
## [4,] "I do not love this film but would still show up"
## [5,] "I do not love this film but would still show up"
## [6,] "I would NOT come to watch this film"
## [7,] "I would NOT come to watch this film"
## [8,] "I would REALLY LIKE to watch this film"
## [9,] "I would REALLY LIKE to watch this film"
## [10,] "I do not love this film but would still show up"
## [11,] "I do not love this film but would still show up"
## [12,] "I do not love this film but would still show up"
## [13,] "I would NOT come to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I would NOT come to watch this film"
## [16,] "I would REALLY LIKE to watch this film"
## [17,] "I do not love this film but would still show up"
## [18,] "I do not love this film but would still show up"
## V8
## [1,] "BadTimesElRoyale"
## [2,] "I would REALLY LIKE to watch this film"
## [3,] "I do not love this film but would still show up"
## [4,] "I would NOT come to watch this film"
## [5,] "I do not love this film but would still show up"
## [6,] "I do not love this film but would still show up"
## [7,] "I would NOT come to watch this film"
## [8,] "I would REALLY LIKE to watch this film"
## [9,] "I would NOT come to watch this film"
## [10,] "I do not love this film but would still show up"
## [11,] "I do not love this film but would still show up"
## [12,] "I do not love this film but would still show up"
## [13,] "I would NOT come to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I do not love this film but would still show up"
## [16,] "I would REALLY LIKE to watch this film"
## [17,] "I do not love this film but would still show up"
## [18,] "I do not love this film but would still show up"
## V9
## [1,] "Willow"
## [2,] "I do not love this film but would still show up"
## [3,] "I do not love this film but would still show up"
## [4,] "I would NOT come to watch this film"
## [5,] "I do not love this film but would still show up"
## [6,] "I would REALLY LIKE to watch this film"
## [7,] "I would NOT come to watch this film"
## [8,] "I do not love this film but would still show up"
## [9,] "I would NOT come to watch this film"
## [10,] "I do not love this film but would still show up"
## [11,] "I do not love this film but would still show up"
## [12,] "I do not love this film but would still show up"
## [13,] "I would NOT come to watch this film"
## [14,] "I do not love this film but would still show up"
## [15,] "I do not love this film but would still show up"
## [16,] "I do not love this film but would still show up"
## [17,] "I would NOT come to watch this film"
## [18,] "I do not love this film but would still show up"
# rev_titles = gsub(' [','',names(titles), fixed = TRUE)
# rev_titles = gsub(']','',rev_titles, fixed = TRUE)
# names(rev_titles) = titles
# colnames(datm) = rev_titles[colnames(datm)]
colnames(datm) = datm[1,]
datm = datm[-1,]
dat = (datm
%>% data.frame()
%>% mutate(Timestamp = substr(Timestamp, 1, 18),
Timestamp = ymd_hms(Timestamp)))
dat_num = (dat
%>% select(-Timestamp)
%>% mutate_all(make_rank))
results = sort(colSums(dat_num), decreasing = TRUE)
res_df = data.frame(results)
# rownames(res_df) = rev_titles[rownames(res_df)]
res_df
## results
## GoodDayDieHard 4
## Untouchables 1
## AMightyWind 0
## PinkPanther 0
## BadTimesElRoyale -1
## HarryAndersons -3
## Willow -4
## SausageParty -6
A Good Day to Die Hard wins with 4 points!
brk_levs = c('I would NOT come\nto watch this film',
'I do not love this film\nbut would still show up',
'I would REALLY LIKE\nto watch this film')
dat_long = (dat
%>% gather(Movies, Votes, -Timestamp)
%>% mutate(Votes = factor(Votes, levels = ranklevs,
labels = brk_levs),
Movies = factor(Movies, levels = names(results))))
#levels(dat_long$Movies) = rev_titles[levels(dat_long$Movies)]
plt = ggplot(dat_long, aes(x = Movies, fill = Votes)) +
geom_histogram(stat = 'count') +
scale_fill_manual(values = cols, name = 'Vote Value') +
ylab('Vote Count') +
rotate_ticks() +
theme(legend.text = element_text(margin = margin(t = 0.5,
b = 0.5,
unit = 'lines')))
png(filename = 'results/current_week.png', height = 480, width = 800)
plt +
theme(axis.title = element_text(size = 20),
axis.text.y = element_text(size = 15),
axis.text.x = element_text(size = 15,
angle = 90,
hjust = 1,
vjust = 0.5),
legend.text = element_text(size = 15, margin = margin(t = 0.5,
b = 0.5,
unit = 'lines')),
legend.title = element_text(size = 20))
#legend.key = element_rect(colour = 'white', size = 10))
dev.off()
## quartz_off_screen
## 2
You can download a .png of the plot here.