Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Eurovision 2016-2018 analysis
To.country Jury Televoting
Netherlands 231 261
Italy 212 253
Russia 125 244
Switzerland 148 212
Norway 47 291
Sweden 239 93
Azerbaijan 197 100
North Macedonia 237 58
Australia 154 131
Iceland 48 186
Czech Republic 150 7
Denmark 69 51
Slovenia 46 59
France 67 38
Cyprus 69 32
Malta 75 20
Serbia 38 54
Albania 43 47
Estonia 38 48
San Marino 16 65
Greece 47 24
Spain 7 53
Israel 12 35
Germany 32 0
Belarus 18 13
United Kingdom 13 3
## Eurovision analysis, May 2019
## Richard D. Morey
## 2016-2018 Data available from https://data.world/datagraver/eurovision-song-contest-scores-1975-2018
library(dplyr)
library(tidyr)
library(ggplot2)
library(purrr)
library(openxlsx)
library(RCurl)
## Read in 2019 data
e2019_csv <- RCurl::getURL("https://gist.githubusercontent.com/richarddmorey/4bf962a8c80154228ff1b896a77951c0/raw/f267c99db693e5c1d27ef10518b43a40b0e9df6c/eurovision2019.csv")
e2019 <-read.csv(text = e2019_csv)
e2019$Year <- 2019
## Read in 2016-2018 data
openxlsx::read.xlsx("eurovision_song_contest_1975_2018v2.xlsx") %>%
mutate(Edition2 = substr(Edition, 5, 10),
Jury.or.Televoting = factor(Jury.or.Televoting, levels = c("J","T"), labels = c("Jury", "Televoting"))) %>%
filter(Year > 2015, Edition2 == "f" ) %>%
group_by(Year, To.country, Jury.or.Televoting) %>%
summarise(Points = sum(Points)) %>%
spread(Jury.or.Televoting, Points) %>%
ungroup() %>%
split(.$Year) -> x
## Combine data
x[["2019"]] <- as_tibble(e2019)
x %>% map_dbl( ~ cor(.$Jury, .$Televoting, method = "k")) -> cors
x %>% map( ~ ggplot(., aes(x = Jury, y = Televoting, label=To.country)) +
geom_point() +
geom_abline(size = .5) +
geom_text(aes(label=To.country),hjust=0, vjust=0) +
coord_trans(x = "sqrt", y = "sqrt") +
expand_limits(y=0, x=0) +
ggtitle(label = paste0(.$Year[1],
", Kendall correlation: ",
round(cors[as.character(.$Year[1])], 3)))
) -> year_plots
year_plots %>% map(print)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.