Skip to content

Instantly share code, notes, and snippets.

@ChiBearsStats
ChiBearsStats / Anthony Miller
Last active May 16, 2021 22:41
Chicago Bears Receivers / Anthony Miller
library(tidyverse)
library(dplyr)
library(ggplot2)
library(ggrepel)
pbp_all <-
readRDS("pbpdata2009to2019.rds")
pbp_2018 <-
pbp_all %>% filter(season == 2018)
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
@ChiBearsStats
ChiBearsStats / Trubisky the Scrambler
Created August 28, 2019 03:28
Trubisky the Scrambler
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 <-
@ChiBearsStats
ChiBearsStats / Icing the Kicker
Created February 17, 2020 00:03
Does Icing the Kicker Matter?
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),
@ChiBearsStats
ChiBearsStats / RIP Parkey & the Insignificance of Kickers
Created August 12, 2019 03:29
RIP Parkey & the Insignificance of Kickers
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)