This repository contains various R scripts for data visualization and analysis.
- xG Trendline.R: This script generates a trendline plot for Manchester United's expected goals (xG).
- waffle.R: This script generates a waffle chart.
- Finishing Variance Line.R: This script generates a plot showing Jamie Vardy's finishing variance.
- Dumbell Chart.R: This script generates a dumbbell chart.
- Bump Chart.R: This script generates a bump chart.
- Alluvial Plot.R: This script generates an alluvial plot.
- Comet.R: This script generates a comet plot.
- Squad Composition.R: This script generates a plot showing squad composition.
- StackedBar.R: This script generates a stacked bar chart for Ligue 1 xG performance by time period.
- Alluvial Plot.R: This script generates an alluvial plot.
- Diamond Scaerplot.R: This script generates a diamond scatterplot.
- app.R: This is a Shiny application that allows you to select and view the plots generated by the other scripts in this repository.
To run the scripts, you will need to have R installed on your machine. You can then run the scripts using an R interpreter.
For the Shiny application, you will need to have the Shiny library installed in R. You can then run the application using the command shiny::runApp()
in the R console.
You can find the repository at Football_analysis.
These scripts depend on several R packages, includingtidyverse
worldfootballR
ggalluvial
extrafont
ggtext
MetBrewer
shiny
ggplot2
ggalt
ggforce
ggrepel
grid
ggplotify
cowplot
ggshakeR
StatsBombR
dplyr
RcppRoll
devtools
understatr
glue
ggsoccer
TTR
patchwork
hexbin
shinyWidgets
ggbraid
ggpubr
future
purrr
plotly
viridis
waffle
. Please ensure these packages are installed before running the scripts.
install.packages("<package_name>")
install.packages("remotes")
remotes::install_github("nsgrantham/ggbraid")
The data used in these scripts is sourced from Understat and FBref via StatsBomb, and WorldFootballR.
- The data is saved as csv files in the data directory.
- scrape_data.R is an example file demonstrating data scraping.
Project done by:
- Pechetti Sai Akhil (B21AI025)
- Prashant Tandon (B21AI053)
- Original work by: harshkrishna17
- We've adapted and aggregated to make a singular app.