EPL Player Stat Assignment

Author

K Bedassa

EPL Player Stat for the Year 2024/25

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.0     ✔ readr     2.1.6
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.2     ✔ tibble    3.3.1
✔ lubridate 1.9.4     ✔ tidyr     1.3.2
✔ purrr     1.2.1     
── 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

ˆ

getwd()
[1] "/Users/kidusteffera/Desktop/DATA110/week 7/Project 1 "
setwd("/Users/kidusteffera/Desktop/DATA110/week 7/Project 1 ")
EPL_Player <- read_csv("epl_player_stats_24_25.csv")
Rows: 562 Columns: 57
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (11): Player Name, Club, Nationality, Position, Conversion %, Passes%, C...
dbl (46): Appearances, Minutes, Goals, Assists, Shots, Shots On Target, Big ...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

I selected the top scorers in each team

top_scorers <- EPL_Player %>%
  filter(Goals > 0) %>%   
  group_by(Club) %>%
  slice_max(order_by = Goals, n = 1, with_ties = FALSE) %>%
  ungroup() %>%
  select(Club, `Player Name`, Nationality, Goals) %>%
  arrange(Goals)  
head(top_scorers, 20)
# A tibble: 20 × 4
   Club                    `Player Name`        Nationality    Goals
   <chr>                   <chr>                <chr>          <dbl>
 1 Ipswich Town            Sam Szmodics         Ireland            4
 2 Southampton             Paul Onuachu         Nigeria            4
 3 Bournemouth             Dango Ouattara       Burkina Faso       7
 4 Manchester United       Amad Diallo          Cote D’Ivoire      8
 5 Arsenal                 Kai Havertz          Germany            9
 6 Everton                 Iliman Ndiaye        Senegal            9
 7 Fulham                  Alex Iwobi           Nigeria            9
 8 Leicester City          Jamie Vardy          England            9
 9 Tottenham Hotspur       Dominic Solanke      England            9
10 West Ham United         Tomás Soucek         Czech Republic     9
11 Brighton & Hove Albion  Danny Welbeck        England           10
12 Crystal Palace          Jean-Philippe Mateta France            14
13 Chelsea                 Cole Palmer          England           15
14 Wolverhampton Wanderers Matheus Cunha        Brazil            15
15 Aston Villa             Ollie Watkins        England           16
16 Brentford               Bryan Mbeumo         Cameroon          20
17 Nottingham Forest       Chris Wood           New Zealand       20
18 Manchester City         Erling Haaland       Norway            22
19 Newcastle United        Alexander Isak       Sweden            23
20 Liverpool               Mohamed Salah        Egypt             29

ggplot Graph

ggplot(top_scorers, aes(x = `Player Name`, y = Goals, fill = `Player Name`)) +
  geom_bar(stat = "identity",) +
  coord_flip() +
  labs(
    title = "Top Goal Scorer from Each Club",
    x = "Top Scoring Players",
    y = "Goals"
  ) +
    theme_minimal(base_size = 15)+
  theme(legend.position = "none")