# setwd('~/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" "GrandBudapestHotel" "WildCard"
## [4] "InBruges" "Jolt" "DoubleOKid"
## [7] "Catch22" "Minecraft" "MarginCall"
names(titles) = c(rownames(tdf))
titles
## Timestamp
## "Timestamp"
## [The Grand Budapest Hotel (2014, 1:40)]
## "GrandBudapestHotel"
## [Wild Card (2015m 1:32)]
## "WildCard"
## [In Bruges (2008, 1:47)]
## "InBruges"
## [Jolt (2021, 1:31)]
## "Jolt"
## [The Double O Kid (1992, 1:34)]
## "DoubleOKid"
## [Catch 22 (1970, 2:02)]
## "Catch22"
## [A Minecraft Movie (2025, 1:41)]
## "Minecraft"
## [Margin Call (2011, 1:42)]
## "MarginCall"
datm[datm %in% names(titles)] = titles[datm[datm %in% names(titles)]]
datm
## V1
## [1,] "Timestamp"
## [2,] "2025/05/27 3:01:42 p.m. AST"
## [3,] "2025/05/28 3:25:24 a.m. AST"
## [4,] "2025/05/28 10:16:57 p.m. AST"
## [5,] "2025/05/29 1:41:36 p.m. AST"
## [6,] "2025/06/03 12:01:14 p.m. AST"
## [7,] "2025/06/03 1:05:14 p.m. AST"
## [8,] "2025/06/03 6:27:00 p.m. AST"
## [9,] "2025/06/08 7:28:26 p.m. AST"
## [10,] "2025/06/10 6:54:04 p.m. AST"
## [11,] "2025/06/11 3:22:09 p.m. AST"
## [12,] "2025/06/16 10:17:53 p.m. AST"
## V2
## [1,] "GrandBudapestHotel"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [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 do not love this film but would still show up"
## [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 would REALLY LIKE to watch this film"
## [12,] "I would NOT come to watch this film"
## V3
## [1,] "WildCard"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [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 do not love this film but would still show up"
## [7,] "I do not love this film but would still show up"
## [8,] "I do not love this film but would still show up"
## [9,] "I do not love this film but would still show up"
## [10,] "I would REALLY LIKE to watch this film"
## [11,] "I do not love this film but would still show up"
## [12,] "I do not love this film but would still show up"
## V4
## [1,] "InBruges"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [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 do not love this film but would still show up"
## [7,] "I do not love this film but would still show up"
## [8,] "I would REALLY LIKE to watch this film"
## [9,] "I do not love this film but would still show up"
## [10,] "I do not love this film but would still show up"
## [11,] "I would NOT come to watch this film"
## [12,] "I do not love this film but would still show up"
## V5
## [1,] "Jolt"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [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 do not love this film but would still show up"
## [7,] "I would REALLY LIKE to watch this film"
## [8,] "I do not love this film but would still show up"
## [9,] "I do not love this film but would still show up"
## [10,] "I would REALLY LIKE to watch this film"
## [11,] "I do not love this film but would still show up"
## [12,] "I do not love this film but would still show up"
## V6
## [1,] "DoubleOKid"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [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 do not love this film but would still show up"
## [7,] "I do not love this film but would still show up"
## [8,] "I do not love this film but would still show up"
## [9,] "I do not love this film but would still show up"
## [10,] "I do not love this film but would still show up"
## [11,] "I would NOT come to watch this film"
## [12,] "I do not love this film but would still show up"
## V7
## [1,] "Catch22"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [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 do not love this film but would still show up"
## [7,] "I do not love this film but would still show up"
## [8,] "I do not love this film but would still show up"
## [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 REALLY LIKE to watch this film"
## V8
## [1,] "Minecraft"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [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 do not love this film but would still show up"
## [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 would REALLY LIKE to watch this film"
## [12,] "I would NOT come to watch this film"
## V9
## [1,] "MarginCall"
## [2,] "I do not love this film but would still show up"
## [3,] "I would REALLY LIKE to watch this film"
## [4,] "I do not love this film but would still show up"
## [5,] "I would REALLY LIKE to watch this film"
## [6,] "I do not love this film but would still show up"
## [7,] "I would REALLY LIKE to watch this film"
## [8,] "I do not love this film but would still show up"
## [9,] "I do not love this film but would still show up"
## [10,] "I do not love this film but would still show up"
## [11,] "I would NOT come to watch this film"
## [12,] "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
## Jolt 3
## GrandBudapestHotel 2
## WildCard 2
## Catch22 2
## MarginCall 2
## InBruges 1
## DoubleOKid 0
## Minecraft -1
Jolt wins with 3 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_bar(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.