The goal of this assignment was to figure out who is the best kicker. My definition of the best kicker has to do with their ability to put points on the scoreboard. In many cases that is by making a Field goal or an Extra point. Therefore I made my criteria for discovering the best kicker that they need to at least have attempted a Field Goal or an Extra Point at least 75 times. The reason for them having to kick at least 75 times because on average they attempt about 30 per season barring no injury.
my_path <- "U:/"
setwd(my_path)
library(RColorBrewer)
library(ggplot2)
library(httr)
library(lubridate)
library(dplyr)
library(data.table)
df <- fread("plays.csv")
df <- df%>%
filter(specialTeamsPlayType %in% c("Extra Point","Field Goal"))%>%
data.frame()
df1 <- fread("games.csv")
df2<- fread("players.csv")
df3 <- fread("PFFScoutingData.csv")
intersect(names(df), names(df2))
## character(0)
combineData <- merge(df, df2, by.x= c('kickerId'), by.y = c("nflId"), all.x = TRUE)
combineData <- merge(combineData,df1, by = c("gameId"),all.x = TRUE)
combineData1 <- combineData%>%
select(specialTeamsPlayType, displayName,specialTeamsResult)%>%
group_by(displayName)%>%
mutate(AttemptGood= ifelse(specialTeamsResult=='Kick Attempt Good',1,0))%>%
mutate(AttemptNoGood= ifelse(specialTeamsResult=='Kick Attempt No Good',1,0))%>%
mutate(Downed= ifelse(specialTeamsResult=='Downed',1,0))%>%
mutate(NoSpecialTeamsResult= ifelse(specialTeamsResult=='Non-Special Teams Result',1,0))%>%
mutate(OutOfBounds= ifelse(specialTeamsResult=='Out of Bounds',1,0))%>%
mutate(BlockedAttempt= ifelse(specialTeamsResult=='Blocked Kick Attempt',1,0))%>%
mutate(n=n())%>%
data.frame()
The X-axis of this plot is ordered by the Kicker name and their Total Attempts. On top of each bar you see the Kickers make percentage regarding to Extra Points. Which is the Made attempts divided by Total Attempts.
extraPointData <- combineData1 %>%
group_by(displayName,specialTeamsPlayType)%>%
summarise(Made=sum(AttemptGood), Missed=sum(AttemptNoGood),
Downed=sum(Downed),NonSpecialResult=sum(NoSpecialTeamsResult),
OutofBound=sum(OutOfBounds), Blocked=sum(BlockedAttempt),.groups = 'keep')%>%
mutate(totalAttempts= Made + Missed + Downed +Blocked + NonSpecialResult,
MadePercentage= round(100*Made/totalAttempts),0)%>%
filter(totalAttempts > 75, MadePercentage > 90.0, specialTeamsPlayType == "Extra Point")%>%
data.frame()
ggplot(extraPointData, aes(x=reorder(displayName,totalAttempts), y= MadePercentage, fill = MadePercentage))+
geom_bar(stat="identity") +
geom_text(aes(label=paste0(MadePercentage,"%")), vjust = -.3)+
theme(axis.text.x = element_text(size = 8, angle = 90))+
xlab('Kicker')+
ylab('Attempts')+
ggtitle('Extra Point Min. 75 Attempts')+
scale_fill_continuous(low = "grey", high = "dark green")
The X-axis of this plot is ordered by the Kicker name and their Total Attempts. On top of each bar you see the Kickers make percentage regarding to Field Goal. Which is the Made attempts divided by Total Attempts.
fieldGoalData <- combineData1 %>%
group_by(displayName,specialTeamsPlayType)%>%
summarise(Made=sum(AttemptGood), Missed=sum(AttemptNoGood),
Downed=sum(Downed),NonSpecialResult=sum(NoSpecialTeamsResult),
OutofBound=sum(OutOfBounds), Blocked=sum(BlockedAttempt),.groups = 'keep')%>%
mutate(totalAttempts= Made + Missed + Downed +Blocked + NonSpecialResult,
MadePercentage= round(100*Made/totalAttempts),0)%>%
filter(totalAttempts > 75, MadePercentage > 80.0, specialTeamsPlayType == "Field Goal")%>%
data.frame()
ggplot(fieldGoalData, aes(x=reorder(displayName,totalAttempts), y= MadePercentage, fill = MadePercentage))+
geom_bar(stat="identity") +
geom_text(aes(label=paste0(MadePercentage,"%")), vjust = -.3)+
theme(axis.text.x = element_text(size = 8, angle = 90))+
xlab('Kicker')+
ylab('Attempts')+
ggtitle('Field Goal Min. 75 Attempts')+
scale_fill_continuous(low = "grey", high = "dark green")
From the criteria I have created from the data I have Justin Tucker would be consider the best kicker due to him having the highest make percentage while still having close to the highest amount of attempts in both categories. The runner up would be Will Lutz.