#Load packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.2 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tidytuesdayR)
library(janitor)
##
## Attaching package: 'janitor'
##
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
tuesdata <- tidytuesdayR::tt_load(2025, week = 40)
## ---- Compiling #TidyTuesday Information for 2025-10-07 ----
## --- There is 1 file available ---
##
##
## ── Downloading files ───────────────────────────────────────────────────────────
##
## 1 of 1: "euroleague_basketball.csv"
eurov <- tuesdata$euroleague_basketball
view(eurov)
#Which countries are most represented in the EuroLeague?
eurov |>
count(Country)
## # A tibble: 11 × 2
## Country n
## <chr> <int>
## 1 France 2
## 2 Germany 1
## 3 Greece 2
## 4 Israel 2
## 5 Italy 2
## 6 Lithuania 1
## 7 Monaco 1
## 8 Serbia 2
## 9 Spain 4
## 10 Turkey 2
## 11 United Arab Emirates 1
#Spain
#How do arena capacities compare across teams and countries? In R, the readr::parse_number() function might be helpful here. #Some cities have two arenas in the column #separate_longer_delim(items, delim = “,”) #parse_number to get the capacity
eurov_sep <- eurov |>
separate_longer_delim(Capacity, delim = ", ")
view(eurov_sep)
eurov_sep$capacity <- parse_number(eurov_sep$Capacity)
#by country
eurov_sep |>
ggplot(aes(x = Country, y = capacity))+
geom_bar(stat = "identity")
#by team
eurov_sep |>
ggplot(aes(x = Team, y = capacity))+
geom_bar(stat = "identity")
#Which clubs have been the most successful historically?
eurov_sep |>
ggplot(aes(x = Team, y = FinalFour_Appearances))+
geom_bar(stat = "identity")
#to filter out the columns with zero
ggplot(
eurov_sep[eurov_sep$FinalFour_Appearances > 0,],
aes(x = Team, y = FinalFour_Appearances))+
geom_bar(stat = "identity")
#Olympiacos and Panathinaikos