library(tidyverse)
library(infer) ## for t-tests
library(ranger) ## for random forest
combined <- read_csv('combined.csv') |>
## drop the unnamed column
select(-1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(worldfootballR) | |
match <- fotmob_get_matches_by_date('2022-05-28') |> filter(name == 'Champions League Final Stage') | |
match_details <- fotmob_get_match_details(match$match_id) | |
match_details |> select(id, home_team, home_team_id, away_team, away_team_id, team_id, min, min_added, xg = expected_goals) |
library(tidyverse)
library(infer)
## Generate some fake data that is similar to your actual data
set.seed(1)
resids <- tibble(
nationality = c(rep('English', 60), rep('non-English', 100), rep('African', 40)),
.resid = c(
rnorm(60, sd = 2) + runif(60, 0, 0.5),
We can't make this file beautiful and searchable because it's too large.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match_id,match_round,league_id,league_name,league_round_name,parent_league_id,parent_league_season,match_time_utc,home_team_id,home_team,home_team_color,away_team_id,away_team,away_team_color,id,event_type,team_id,player_id,player_name,x,y,min,min_added,is_blocked,is_on_target,goal_crossed_y,expected_goals,expected_goals_on_target,shot_type,situation,period,is_own_goal,on_goal_shot_x,on_goal_shot_y,on_goal_shot_zoom_ratio,first_name,last_name,team_color,short_name,blocked_x,blocked_y,goal_crossed_z | |
3411352,1,47,Premier League,Premier League Round 1,47,2022/2023,"Sat, Sep 12, 2020, 11:30 UTC",9879,Fulham,#000000,9825,Arsenal,#bd0510,2210246139,AttemptSaved,9879,149150,Denis Odoi,84.7373786408,18.254012473628215,7,,FALSE,TRUE,31.559999999999995,0.0274,0.115,LeftFoot,RegularPlay,FirstHalf,FALSE,1.6455026455026467,0.29047618904761907,1,Denis,Odoi,#000000,,,, | |
3411352,1,47,Premier League,Premier League Round 1,47,2022/2023,"Sat, Sep 12, 2020, 11:30 UTC",9879,Fulham,#000000,9825,Arsenal,#bd0510,2210246547,Miss,9825, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qs_from_url <- function(url){ | |
load <- try(curl::curl_fetch_memory(url), silent = TRUE) | |
if (inherits(load, "try-error")) { | |
cli::cli_warn("Failed to retrieve data from {.url {url}}") | |
return(data.frame()) | |
} | |
content <- try(qs::qdeserialize(load$content), silent = TRUE) |
library(readr)
library(dplyr)
library(devtools)
shots <- read_csv('shots_1549727.csv')
glimpse(shots)
#> Rows: 22
#> Columns: 14
#> $ season_id <dbl> 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021~
library(readr)
library(ggplot2)
library(broom)
df <- 'penalty.csv' %>%
read_csv() %>%
transmute(
xgot = expectedGoalsOnTarget,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* rs-theme-name: a semi-cursive poolside tony */ | |
/* rs-theme-is-dark: TRUE */ | |
.ace_gutter { | |
background: #353454; | |
color: rgba(204, 204, 204, 0.7); | |
} | |
.ace_print-margin { | |
width: 2px; | |
background: rgba(204, 204, 204, 0.5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* rs-theme-name: a poolside tony */ | |
/* rs-theme-is-dark: TRUE */ | |
.ace_gutter { | |
background: #353454; | |
color: rgba(204, 204, 204, 0.7); | |
} | |
.ace_print-margin { | |
width: 2px; | |
background: rgba(204, 204, 204, 0.5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load packages | |
library(tidyverse) | |
library(metR) | |
library(nbastatR) | |
library(extrafont) | |
library(teamcolors) | |
library(cowplot) | |
# Custom theme |