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(showtext) | |
library(hexSticker) | |
library(jpeg) | |
library(magick) | |
## Automatically use showtext to render text for future devices | |
showtext_auto() | |
font_add_google("Fjalla One") | |
font_add_google("Playfair Display") | |
font_add_google("Great Vibes") | |
font_add_google("Zilla Slab") |
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
pacman::p_load_current_gh("saiemgilani/cfbfastR") | |
x <- cfbfastR::cfbd_game_player_stats(year = 2020, week = 15, team = "Alabama") | |
dplyr::glimpse(x) |
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(cfbscrapR) | |
library(tidyverse) | |
#--- Play by Play Data Pull ----------------------------------------------- | |
week_vector = 1:2 | |
year_vector = 2020 | |
weekly_year_df = expand.grid(year = year_vector, week = week_vector) | |
### scrape yearly | |
year_split = split(weekly_year_df, weekly_year_df$year) | |
year_split[[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(tidyverse) | |
library(cfbscrapR) | |
library(ggimage) | |
library(gt) | |
library(png) | |
## Pull season data from cfbscrapR | |
# Play Level Data | |
pbp_2019 <- data.frame() | |
for(i in 1:15){ |
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
#Defensive Team Pass/Rush EPA | |
pbp_2019 %>% select(offense_play, defense_play, down, distance, play_type, yards_gained) %>% head() | |
glimpse(pbp_2019) | |
levels(factor(pbp_2019$play_type)) | |
pbp_2019 %>% count(play_type, sort = TRUE) | |
plays <- pbp_2019 %>% filter(rush == 1 | pass == 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
#Offensive Team Pass/Rush EPA | |
team_epa <- left_join(offense, defense, by = c("offense_play" = "defense_play")) | |
cfblogos <- read.csv("https://raw.githubusercontent.com/saiemgilani/NCAA_FB_EPA/master/logos.csv") %>% select(school, logo) | |
team.epa <- team_epa %>% left_join(cfblogos, by = c("offense_play" = "school")) | |
head(team.epa) | |
team.epa %>% ggplot(aes(x=epa.rush.off, y=epa.pass.off)) + geom_image(image = team.epa$logo, asp = 16/9) |
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
################################## | |
# If this is your first time working with R, | |
# tidyverse, devtools, remotes, ggimage, cfbscrapR, or GT: | |
# Uncomment (highlight and Ctrl-Shift-C) | |
# and install by running (highlight and Ctrl-C) the below six lines as necessary | |
# install.packages("tidyverse") | |
# install.packages("devtools") | |
# install.packages("remotes") | |
# install.packages("ggimage") | |
# devtools::install_github("meysubb/cfbscrapR") |
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
id,school,mascot,abbreviation,alt_name1,alt_name2,alt_name3,conference,division,color,alt_color,logo,logos[1] | |
2000,Abilene Christian,Wildcats,ACU,,ACU,Abil Christian,,,#4e2683,#ebebeb,http://a.espncdn.com/i/teamlogos/ncaa/500/2000.png,http://a.espncdn.com/i/teamlogos/ncaa/500-dark/2000.png | |
2001,Adams State,Grizzlies,ADST,,ADST,Adams St,,,#000000,,http://a.espncdn.com/i/teamlogos/ncaa/500/2001.png,http://a.espncdn.com/i/teamlogos/ncaa/500-dark/2001.png | |
2003,Adrian,Bulldogs,ADR,,ADR,Adrian,,,#000000,,http://a.espncdn.com/i/teamlogos/ncaa/500/2003.png,http://a.espncdn.com/i/teamlogos/ncaa/500-dark/2003.png | |
2005,Air Force,Falcons,AFA,,AFA,Air Force,Mountain West,Mountain,#004a7b,#ffffff,http://a.espncdn.com/i/teamlogos/ncaa/500/2005.png,http://a.espncdn.com/i/teamlogos/ncaa/500-dark/2005.png | |
2006,Akron,Zips,AKR,,AKR,Akron,Mid-American,East,#00285e,#84754e,http://a.espncdn.com/i/teamlogos/ncaa/500/2006.png,http://a.espncdn.com/i/teamlogos/ncaa/500-dark/2006.png | |
333,Alabama,Crimson Tide,ALA,,ALA,Alabama,SEC,West,#6 |