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(nflscrapR) | |
library(ggthemes) | |
#I already have 2009 - Present data compiled. If you do not have NFL PBP data, see nflscrapR, @LeeSharpeNFL, or @BenBaldwin for their tutorials for pulling NFL pbpdata | |
kicking <- pbpfull %>% | |
select(posteam, defteam, desc, half_seconds_remaining, qtr, field_goal_attempt, field_goal_result, kick_distance, timeout, timeout_team, score_differential) %>% | |
mutate(timeoutbeforekick = ifelse(lag(timeout) == 1, 1, 0), | |
timeoutteam = ifelse(timeoutbeforekick == 1, lag(timeout_team), 0), |
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(dplyr) | |
library(ggplot2) | |
library(ggrepel) | |
library(ggimage) | |
library(ggthemes) | |
library(cowplot) | |
#Pre-Loaded Data. See Ben Baldwin's Tutorial for help loading/wrangling the pbp data (https://gist.github.com/guga31bb/5634562c5a2a7b1e9961ac9b6c568701) | |
pbp_all_rp <- |
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(nflscrapR) | |
library(tidyverse) | |
library(ggrepel) | |
library(ggimage) | |
pbp_all <- readRDS("pbpdata2009to2019.rds") #I just use prescraped data, but if you don't know where to get this, I would recommend reading Ben Baldwin's tutorial: | |
#(https://gist.github.com/guga31bb/5634562c5a2a7b1e9961ac9b6c568701) |
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(dplyr) | |
library(ggplot2) | |
library(ggrepel) | |
pbp_all <- | |
readRDS("pbpdata2009to2019.rds") | |
pbp_2018 <- | |
pbp_all %>% filter(season == 2018) |
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(nflscrapR) | |
library(tidyverse) | |
library(ggrepel) | |
library(ggimage) | |
#Load the PBP Data from 2009-2018 (based on Ben Baldwin's post) | |
first <- 2009 #first season to grab. min available=2009 |