[https://media.ed.ac.uk/media/HealthyR+demoA+geom_bar%28%29+vs+geom_col%28%29/1_49w03lqk]
Day 02 of HealthyR demo
geom_bar() vs geom_col()
The Eurovision Song Contest (French: Concours Eurovision de la chanson), often known simply as Eurovision or by its initialism ESC, is an international song competition organised annually by the European Broadcasting Union. Each participating country submits an original song to be performed live and transmitted to national broadcasters via the Eurovision and Euroradio networks, with competing countries then casting votes for the other countries’ songs to determine a winner.
El Festival de la Canción de Eurovisión (en francés: Concours Eurovision de la chanson), a menudo conocido simplemente como Eurovisión o por sus iniciales ESC, es un concurso internacional de canciones organizado anualmente por la Unión Europea de Radiodifusión. Cada paÃs participante envÃa una canción original para ser interpretada en vivo y transmitida a las emisoras nacionales a través de las redes de Eurovisión y Euroradio, y luego los paÃses competidores votan por las canciones de los demás paÃses para determinar un ganador.
library(tidyverse)
eurovision <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-05-17/eurovision.csv')
eurovision
## # A tibble: 2,005 × 18
## event host_city year host_country event_url section artist song artist_url
## <chr> <chr> <dbl> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 Turin… Turin 2022 Italy https://… first-… Kalus… Stef… https://e…
## 2 Turin… Turin 2022 Italy https://… first-… S10 De D… https://e…
## 3 Turin… Turin 2022 Italy https://… first-… Amand… Die … https://e…
## 4 Turin… Turin 2022 Italy https://… first-… MARO Saud… https://e…
## 5 Turin… Turin 2022 Italy https://… first-… Intel… Inte… https://e…
## 6 Turin… Turin 2022 Italy https://… first-… LPS Disko https://e…
## 7 Turin… Turin 2022 Italy https://… first-… Rosa … Snap https://e…
## 8 Turin… Turin 2022 Italy https://… first-… Subwo… Give… https://e…
## 9 Turin… Turin 2022 Italy https://… first-… Monik… Sent… https://e…
## 10 Turin… Turin 2022 Italy https://… first-… Zdob … Tren… https://e…
## # ℹ 1,995 more rows
## # ℹ 9 more variables: image_url <chr>, artist_country <chr>,
## # country_emoji <chr>, running_order <dbl>, total_points <dbl>, rank <dbl>,
## # rank_ordinal <chr>, qualified <lgl>, winner <lgl>
eurovision %>%
count(winner)
## # A tibble: 2 × 2
## winner n
## <lgl> <int>
## 1 FALSE 1716
## 2 TRUE 289
eurovision %>%
count(artist_country, sort = TRUE)
## # A tibble: 52 × 2
## artist_country n
## <chr> <int>
## 1 Sweden 74
## 2 Norway 73
## 3 Belgium 72
## 4 Netherlands 72
## 5 Switzerland 70
## 6 Germany 67
## 7 France 66
## 8 Finland 65
## 9 United Kingdom 65
## 10 Ireland 62
## # ℹ 42 more rows
artist_country —- paÃs del artista
eurovision %>%
ggplot(aes(x = artist_country, fill = winner)) +
geom_bar(position = "fill") +
coord_flip()
eurovision %>%
count(artist_country, winner) %>%
group_by(artist_country) %>%
mutate(nn = sum(n),
prop = n / nn) %>%
mutate(prop = if_else(!winner, 0, prop)) %>%
ggplot(aes(y = fct_reorder(artist_country, prop), x = n, fill = winner)) +
labs(title = "Classification - Clasificación",
subtitle = "by winning country - por paÃs ganador",
x = "percentage - porcentaje",
y ="artist's country - pais del artista",
)+
geom_col(position = "fill")