# Kaggle Competition
# NFL punt rule suggestion
# by Sandra Sexton and Daniel Matutat/ Dans/ mutant99
# January 8, 2019

# Set working directory
# Need packages: ggplot2, dplyr
library(ggplot2)
library(dplyr)
library(reshape2)
library(utils)

# Import datasets
video_review <- read.csv("../input/video_review.csv", header=TRUE)
video_footage.injury <- read.csv("../input/video_footage-injury.csv", header=TRUE)
video_footage.control <- read.csv("../input/video_footage-control.csv", header=TRUE)
player.punt.data <- read.csv("../input/player_punt_data.csv", header=TRUE)
player.role.data <- read.csv("../input/play_player_role_data.csv", header=TRUE)

# Rename column names to match amoungst datasets and differentiate injury
colnames(video_review)[colnames(video_review)=="PlayID"] <- "playid"
colnames(video_review)[colnames(video_review)=="GameKey"] <- "gamekey"
colnames(video_review)[colnames(video_review)=="Season_Year"] <- "season"
colnames(video_footage.control)[colnames(video_footage.control)=="Season_Type"] <- "Type"
colnames(video_footage.injury)[colnames(video_footage.injury)=="PREVIEW.LINK..5000K."] <- "Preview.Link"
colnames(player.role.data)[colnames(player.role.data)=="Season_Year"] <- "season"
colnames(player.role.data)[colnames(player.role.data)=="GameKey"] <- "gamekey"
colnames(player.role.data)[colnames(player.role.data)=="PlayID"] <- "playid"
video_footage.control$Injury= "no injury"
video_footage.injury$Injury= "injury"

# Combine datasets
file1 <- rbind(video_footage.control, video_footage.injury)
file2 <- merge(video_review, file1, by=c("playid", "gamekey", "season"), all.y=TRUE)

#---------------------------------------------------------

# Get numbers of injured players using player_punt_data
file3 <- merge(file2, player.punt.data, by=c("GSISID"), all.x=TRUE)

# Upon examination of merged datasets, there are 21 more rows than there should be. 
# Some players have multiple numbers. Must look in video footage and internet search to identify correct number and delete incorrect.
file4 <- file3[-c(14, 15, 17, 21, 23, 25, 26, 29, 31, 33, 34, 37, 39, 42, 44, 45, 47, 51, 53, 56, 57),]

# Get numbers of injury causing players using player_punt_data
# For multiple numbers, look in video footage to identify correct number and delete incorrect.
file5 <- merge(file4, player.punt.data, by.x=c("Primary_Partner_GSISID"), by.y=c("GSISID"), all.x=TRUE)

# Upon examination of merged datasets, there are 24 more rows than there should be. 
# Some players have multiple numbers. Must look in video footage and internet search to identify correct number and delete incorrect.
file6 <- file5[-c(9, 10, 11, 13, 15, 16, 18, 19, 23, 24, 27, 31, 35, 37, 39, 40, 42, 43, 49, 50, 52, 53, 54, 58),]

#---------------------------------------------------------

# Get role of injured person in the game
file7 <- merge(player.role.data, file6, by=c("season", "gamekey", "playid", "GSISID"), all.y=TRUE)

# Get role of injuring person in the game
colnames(player.role.data)[colnames(player.role.data)=="GSISID"] <- "Primary_Partner_GSISID"
file8 <- merge(player.role.data, file7, by=c("season", "gamekey", "playid", "Primary_Partner_GSISID"), all.y=TRUE)

# Rename some columns for more clarity
colnames(file8)[colnames(file8)=="season"] <- "Season"
colnames(file8)[colnames(file8)=="gamekey"] <- "Game_Key"
colnames(file8)[colnames(file8)=="playid"] <- "Play_Id"
colnames(file8)[colnames(file8)=="Primary_Partner_GSISID"] <- "Injuring_GSISID"
colnames(file8)[colnames(file8)=="Role.x"] <- "Injuring_Role"
colnames(file8)[colnames(file8)=="Role.y"] <- "Injured_Role"
colnames(file8)[colnames(file8)=="Player_Activity_Derived"] <- "Injured_Activity"
colnames(file8)[colnames(file8)=="Primary_Partner_Activity_Derived"] <- "Injuring_Activity"
colnames(file8)[colnames(file8)=="Preview.Link"] <- "Preview_Link"
colnames(file8)[colnames(file8)=="Number.x"] <- "Injured_Number"
colnames(file8)[colnames(file8)=="Position.x"] <- "Injured_Position"
colnames(file8)[colnames(file8)=="Number.y"] <- "Injuring_Number"
colnames(file8)[colnames(file8)=="Position.y"] <- "Injuring_Position"
colnames(file8)[colnames(file8)=="GSISID"] <- "Injured_GSISID"

# Rearranged columns to make easier to read
file8 <- file8[c(1,2,3,14,13,15,16,17,9,20,10,12,6,4,7,5,8,11,22,24,21,23,18,19)]

#---------------------------------------------
# Extract nature of play - faircatch, outofbounds, tackle
extractPlay <- function(PlayDescription) {
  PlayDescription <- as.character(PlayDescription)
  
  if(length(grep("fair", PlayDescription)) >0) {
    return("faircatch")
  } else if(length(grep(", out of bounds", PlayDescription)) >0) {
    return("out of bounds")
  } else {
    return("tackle")
  }
}

Play <- NULL
for(i in 1:nrow(file8)){
  Play <- c(Play, extractPlay(file8[i,"PlayDescription"]))
}
file8$Play <- as.factor(Play)
#--------------------------------------------

# Usage of outside data is allowed.
# Since not available in datasets, use videos to determine seconds between punt and injury, injured offense or defense,
# injuring offense or defense, injured hit above or below waist, injuring hit above or below waist, injured hit front/ side/ back,
# who had ball when injury happened, punt returner involved in injury event.
video.data = data.frame(
  Game_Key=c(5,21,29,45,54,60,144,149,189,218,231,234,266,274,280,280,281,289,296,357,364,364,384,392,397,399,414,448,473,506,553,567,585,585,601,607,618),
  Play_Id=c(3129,2587,538,1212,1045,905,2342,3663,3509,3468,1976,3278,2902,3609,2918,3746,1526,2341,2667,3630,2489,2764,183,1088,1526,3312,1262,2792,2072,1988,1683,1407,733,2208,602,978,2792),
  Sec_Punt_Injury=c(9,4,5,12,NA,0,NA,8,10,NA,10,6,4,NA,0,9,7,9,5,8,6,7,6,12,9,6,10,9,8,9,8,12,10,10,7,0,12),
  Injured_Off_Def=c("defense","defense","defense","defense","unsure","defense","offense","offense","offense","unsure","defense","offense","offense","defense","defense","defense","defense","defense","defense","defense","defense","offense","defense","defense","defense","offense","defense","defense","defense","offense","defense","offense","defense","defense","defense","defense","defense"),
  Injuring_Off_Def=c("offense","offense","offense","offense","unsure","offense","defense","defense","defense","unsure","offense","defense","defense","offense","offense","offense","defense","offense","defense","offense","offense","defense","defense","offense","offense","defense","na","offense","defense","defense","offense","defense","offense","offense","offense","offense","offense"),
  Injured_Waist=c("above","above","above","above","unsure","above","unsure","above","above","unsure","above","above","below","above","above","above","above","above","above","above","above","above","above","above","above","above","na","above","above","above","above","above","above","above","above","above","above"),
  Injuring_Waist=c("below","above","below","above","unsure","above","unsure","above","above","unsure","above","above","above","above","above","above","above","above","above","above","above","above","below","above","above","above","na","above","below","above","above","above","above","above","above","above","above"),  
  Injured_Direction=c("front","front","front","front","unsure","front","unsure","front","front","unsure","front","front","front","side","front","front","front","side","front","side","side","front","front","front","front","front","na","side","front","front","front","front","side","side","front","front","side"),  
  Ball_Holder=c("PR","noone","PR","PR","unsure","kicker","unsure","PR","PR","unsure","PR","defense","PR","kicker","kicker","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","PR","kicker","PR"),
  PR_Secondary=c("no","no","no","no","no","no","no","no","no","no","no","no","no","no","no","no","no","no","PR","no","no","no","PR","no","no","no","no","no","PR","no","no","no","no","no","no","no","no")
  )

# Add to file8 dataset
file8 <- merge(file8, video.data, by=c("Game_Key", "Play_Id"), all.x=TRUE)

#--------------------------------------------
#Use given datasets to do some exploratory charts
# Is regular or pre-season significant?
file8.typetable <- table(factor(file8$Type))
file8.type <- barplot(file8.typetable, main="Injuries Regular vs Pre-Season")

# Is quarter significant?
file8.qtrtable <- table(factor(file8$Qtr))
file8.qtr <- barplot(file8.qtrtable, main="Quarter Injuries Occurred in", xlab="quarter")

# Is week significant?
file8.weektable <- table(factor(file8$Week))
file8.week <- barplot(file8.weektable, main="Week that Injuries Occurred in", xlab="week")

# What is primary impact type?
file8.impacttable <- table(factor(file8$Primary_Impact_Type))
file8.impact <- barplot(file8.impacttable, main="Primary Impact Type for Injuries")

# Was it friendly fire?
file8.friendlytable <- table(factor(file8$Friendly_Fire))
# file8.friendlytable %>% filter(is.na(file8.friendlytable) == FALSE) %>%
file8.friendly <- barplot(file8.friendlytable, main="Friendly Fire Occurrences for Injuries")

# In injury gorup, how many were tackles, fair catch or out of bounds play?
file8.naturepre <- droplevels(subset(file8, Injury=="injury"))
file8.naturetable <- table(factor(file8.naturepre$Play))
file8.nature <- barplot(file8.naturetable, main="Nature of Play that Caused the Injury")

# In non-injury group, how many were tackles, fair catch or out of bounds play?
file8.naturepre2 <- droplevels(subset(file8, Injury=="no injury"))
file8.naturetable2 <- table(factor(file8.naturepre2$Play))
file8.nature2 <- barplot(file8.naturetable2, main="Nature of Play within Non-Injury Group")

# Chart Play according to injury and non-injury datasets
ggplot(file8, aes(x=Play, fill=Injury)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727','#ff7676')) +
  ggtitle("Nature of Play for Injured vs Injuring Event")


#-----------------------------------------------------------
#Use data retrieved from the videos
# How many seconds between the punt and injury event?
file8.sectable <- table(factor(file8$Sec_Punt_Injury))
file8.sec <- barplot(file8.sectable, main="What is the Number of Seconds Between Punt and Injury", xlab="seconds")

# Is the injured player offense or defense?
file8.table1 <- table(factor(file8$Injured_Off_Def))
file8.injured.off <- barplot(file8.table1, main="Is Injured Player Offense or Defense?")

# Is the injuring player offense or defense?
file8.table2 <- table(factor(file8$Injuring_Off_Def))
file8.injuring.off <- barplot(file8.table2, main="Is Injuring Player Offense or Defense?")

# Is the injured player hit above or below the waist?
file8.table3 <- table(factor(file8$Injuring_Waist))
file8.hit <- barplot(file8.table3, main="Was the Injured Player Hit Above or Below the Waist?")

# Is the injured player hit from the front, side or back?
file8.table4 <- table(factor(file8$Injured_Direction))
file8.front <- barplot(file8.table4, main="Was the Injured Player Hit From the Front, Side or Back?")

# Who had the ball when the injury happened?
file8.table5 <- table(factor(file8$Ball_Holder))
file8.ball <- barplot(file8.table5, main="Who Had the Ball When the Injury Happened?")

#---------------------------------------------------
# What was the position of injured person?
file8.subset1 <- droplevels(subset(file8, Injury=='injury'))
file8.subset2 <- subset(file8.subset1, select=c("Injured_Position", "Injuring_Position", "Injured_GSISID"))
file8.subset3 <- melt(file8.subset2, id.vars="Injured_GSISID", na.rm=TRUE)
colnames(file8.subset3)[3] <- "Position"
colnames(file8.subset3)[2] <- "Injury"
file8.subset4 <- subset(file8.subset3, Injury=='Injured_Position')
ggplot(file8.subset4, aes(x=Position)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727')) +
  ggtitle("Position of Injured Person")
# Seems mostly evenly distributed across 6 different positions

# What was the position of the injuring person?
file8.subset5 <- subset(file8.subset3, Injury=='Injuring_Position')
ggplot(file8.subset5, aes(x=Position)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727')) +
  ggtitle("Position of Injuring Person")
# OLB is clearly the most prominent injuring person. By their very nature, they are...

# What was the combination of positions of injured person playing & injuring position 
ggplot(file8.subset3, aes(x=Position, fill=Injury)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727','#ff7676', '#4dff4d')) +
  ggtitle("Number of Times Certain Position Involved in Injured vs Injuring Event")

#-------------------------------------------------------------
# What was the activity of injured person?
file8.subset1 <- droplevels(subset(file8, Injury=='injury'))
file8.subset5 <- subset(file8.subset1, select=c("Injured_Activity", "Injuring_Activity", "Injured_GSISID"))
file8.subset6 <- melt(file8.subset5, id.vars="Injured_GSISID", na.rm=TRUE)
colnames(file8.subset6)[3] <- "Activity"
colnames(file8.subset6)[2] <- "Injury"
file8.subset7 <- subset(file8.subset6, Injury=='Injured_Activity')
ggplot(file8.subset7, aes(x=Activity)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727')) +
  ggtitle("Activity of Injured Person")
# Seems somewhat divided across 5 roles

# What was the activity of the injuring person?
file8.subset8 <- subset(file8.subset6, Injury=='Injuring_Activity')
ggplot(file8.subset8, na.rm = TRUE, aes(x=Activity)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727')) +
  ggtitle("Activity of Injuring Person")
# PR has almost double the number of the next closest one

# What was the combination of activities of injured person playing & injuring position 
ggplot(file8.subset6, aes(x=Activity, fill=Injury)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727','#ff7676', '#4dff4d')) +
  ggtitle("Number of Times Certain Activity Involved in Injured vs Injuring Event")

#------------------------------------------------
# What was the role of injured person?
file8.subset1 <- droplevels(subset(file8, Injury=='injury'))
file8.subset5 <- subset(file8.subset1, select=c("Injured_Role", "Injuring_Role", "Injured_GSISID"))
file8.subset9 <- melt(file8.subset5, id.vars="Injured_GSISID", na.rm=TRUE)
colnames(file8.subset9)[3] <- "Role"
colnames(file8.subset9)[2] <- "Injury"
file8.subset10 <- subset(file8.subset9, Injury=='Injured_Role')
ggplot(file8.subset10, aes(x=Role)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727')) +
  ggtitle("Role of Injured Person")

# What was the role of the injuring person?
file8.subset11 <- subset(file8.subset9, Injury=='Injuring_Role')
ggplot(file8.subset11, na.rm = TRUE, aes(x=Role)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727')) +
  ggtitle("Role of Injuring Person")

# What was the combination of roles of injured person playing & injuring position 
ggplot(file8.subset9, aes(x=Role, fill=Injury)) + 
  geom_bar(stat="count", width=0.2) +
  scale_fill_manual(values=c('#ff2727','#ff7676', '#4dff4d')) +
  ggtitle("Number of Times Certain Role Involved in Injured vs Injuring Event")

#--------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------------------------
#Use NGS data to develop a picture of what is happening and look for subgroups
#--------------------------------------------------
# Load all NSG datasets 
NGS.2016.post <- read.csv("../input/NGS-2016-post.csv", header=TRUE)
NGS.2016.pre <- read.csv("../input/NGS-2016-pre.csv", header=TRUE)
NGS.2016.reg.wk1to6 <- read.csv("../input/NGS-2016-reg-wk1-6.csv", header=TRUE)
NGS.2016.reg.wk7to12 <- read.csv("../input/NGS-2016-reg-wk7-12.csv", header=TRUE)
NGS.2016.reg.wk12to17 <- read.csv("../input/NGS-2016-reg-wk13-17.csv", header=TRUE)
NGS.2017.post <- read.csv("../input/NGS-2017-post.csv", header=TRUE)
NGS.2017.pre <- read.csv("../input/NGS-2017-pre.csv", header=TRUE)
NGS.2017.reg.wk1to6 <- read.csv("../input/NGS-2017-reg-wk1-6.csv", header=TRUE)
NGS.2017.reg.wk7to12 <- read.csv("../input/NGS-2017-reg-wk7-12.csv", header=TRUE)
NGS.2017.reg.wk12to17 <- read.csv("../input/NGS-2017-reg-wk13-17.csv", header=TRUE)

# NGS too large to bind so will use individual files
#--------------------------------------------------
colnames(NGS.2016.pre)[1] <- "Season"
colnames(NGS.2016.pre)[2] <- "Game_Key"
colnames(NGS.2016.pre)[3] <- "Play_Id"
colnames(NGS.2016.pre)[4] <- "GSISID"

# Does tackle represent injury time?
NGS.2016.pre.subset1 <- subset(NGS.2016.pre, Event=="tackle")
NGS.2016.pre.subset2 <- subset(NGS.2016.pre.subset1, Game_Key==29)
NGS.2016.pre.subset3 <- subset(NGS.2016.pre.subset2, Play_Id==538)
ggplot(NGS.2016.pre.subset3, aes(x=x, y=y)) + geom_point()
# Comparing video still of position of players vs scatterplot of players at tackle, tackle does not represent injury time
# Must use the times obtained by manually reviewing videos.
# Get time of punt_received and time collision. Punt received is obvious event in video. Take the difference from the Time given in NGS dataset and use this for injury data.
#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=5, PlayId=3129)
event.punt1 <- subset(NGS.2016.pre, Game_Key==5 & Play_Id==3129 & Event=="punt")
event.punt1 <- event.punt1[order(event.punt1$x),] 
ggplot(event.punt1, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=5 & PuntId=3129") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec1 <- subset(NGS.2016.pre, Game_Key==5 & Play_Id==3129 & Event=="punt_received")
ggplot(event.rec1, aes(x=x, y=y)) + geom_point(size=4)
event.rec1 <- event.rec1[order(event.rec1$x),] 
event.rec1$Team <- c("offense","offense","defense", "offense", "defense","","","","","","","","","","","","","","","","","")
event.rec1$Event <- c("PR/Injuring/Ball", "","","","","","","","","","","","","","","","Injured","","","","","")
ggplot(event.rec1, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=5 & PuntId=3129")

event.inj1 <- subset(NGS.2016.pre, Game_Key==5 & Play_Id==3129 & Time=="2016-08-12 02:07:47.000")
ggplot(event.inj1, aes(x=x, y=y)) + geom_point(size=4) +
  geom_text(aes(label=GSISID, vjust=1.5))
#N

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=29, PlayId=538)
event.punt2 <- subset(NGS.2016.pre, Game_Key==29 & Play_Id==538 & Event=="punt")
event.punt2 <- event.punt2[order(event.punt2$x),] 
ggplot(event.punt2, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=29 & PuntId=538") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec1 <- subset(NGS.2016.pre, Game_Key==29 & Play_Id==538 & Event=="punt_received")
ggplot(event.rec1, aes(x=x, y=y)) + geom_point(size=4)
event.rec1 <- event.rec1[order(event.rec1$x),] 
event.rec1$Team <- c("offense","defense","offense", "defense", "offense","","","","","","","","","","","","","","","","","")
event.rec1$Event <- c("PR/Injuring/Ball", "Injured","","","","","","","","","","","","","","","","","","","","")
ggplot(event.rec1, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=20 & PuntId=258")

event.inj1 <- subset(NGS.2016.pre, Game_Key==29 & Play_Id==538 & Time=="2016-08-19 23:53:46.300")
ggplot(event.inj1, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj1 <- event.inj1[order(event.inj1$x),] 
event.inj1$Team <- c("offense","defense","offense", "defense", "offense","","","","","","","","","","","","","","","","","")
event.inj1$Event <- c("PR/Injuring/Ball", "Injured","","","","","","","","","","","","","","","","","","","","")
ggplot(event.inj1, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=20 & PuntId=258")

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=45, PlayId=1212)
event.punt3a <- subset(NGS.2016.pre, Game_Key==45 & Play_Id==1212 & Event=="punt")
event.punt3a <- event.punt3a[order(event.punt3a$x),] 
ggplot(event.punt3a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=20 & PuntId=258") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec3a <- subset(NGS.2016.pre, Game_Key==45 & Play_Id==1212 & Event=="punt_received")
ggplot(event.rec3a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj3a <- subset(NGS.2016.pre, Game_Key==45 & Play_Id==1212 & Time=="2016-08-28 00:28:47.800")
ggplot(event.inj3a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=189, PlayID=3509)
event.punt4a <- subset(NGS.2016.reg.wk7to12, GameKey==189 & PlayID==3509 & Event=="punt")
ggplot(event.punt4a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=20 & PuntId=258") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec4a <- subset(NGS.2016.reg.wk7to12, GameKey==189 & PlayID==3509 & Event=="punt_received")
ggplot(event.rec4a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj4a <- subset(NGS.2016.reg.wk7to12, GameKey==189 & PlayID==3509 & Time=="2016-11-06 21:00:55.100")
ggplot(event.inj4a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=234, PlayId=3278)
event.3278 <- subset(NGS.2016.reg.wk7to12, GameKey==234 & PlayID==3278)
event.punt5a <- subset(NGS.2016.reg.wk7to12, GameKey==234 & PlayID==3278 & Event=="punt")
event.punt5a <- event.punt5a[order(event.punt2$x),] 
ggplot(event.punt5a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=234 & PuntId=3278") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec5a <- subset(NGS.2016.reg.wk7to12, GameKey==234 & PlayID==3278 & Event=="punt_downed")
ggplot(event.rec5a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec5a <- event.rec5a[order(event.rec5a$x),] 
event.rec5a$Team <- c("offense","defense","offense", "offense", "offense","","","","","","","","","","","","","","","","","")
event.rec5a$Event <- c("PR", "Ball/Injuring","","Injured","","","","","","","","","","","","","","","","","","")
ggplot(event.rec5a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=234 & PuntId=3278")

event.inj5a <- subset(NGS.2016.reg.wk7to12, GameKey==234 & PlayID==3278 & Time=="2016-11-27 20:32:15.500")
ggplot(event.inj5a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj5a <- event.inj5a[order(event.inj5a$x),] 
event.inj5a$Team <- c("offense","defense","offense", "offense", "offense","","","","","","","","","","","","","","","","","")
event.inj5a$Event <- c("PR", "Ball/Injuring","","Injured","","","","","","","","","","","","","","","","","","")
ggplot(event.inj5a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=234 & PuntId=3278")

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=266, PlayId=2902)
event.2902 <- subset(NGS.2016.reg.wk12to17, GameKey==266 & PlayID==2902)
event.punt6a <- subset(NGS.2016.reg.wk12to17, GameKey==266 & PlayID==2902 & Event=="punt")
event.punt6a <- event.punt6a[order(event.punt2$x),] 
ggplot(event.punt6a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=266 & PuntId=2902") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec6a <- subset(NGS.2016.reg.wk12to17, GameKey==266 & PlayID==2902 & Time=="2016-12-11 20:30:37.600")
ggplot(event.rec6a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec6a <- event.rec6a[order(event.rec6a$x),] 
event.rec6a$Team <- c("","","", "", "","","","","","","","","","","","","","","defense","offense","defense","offense")
event.rec6a$Event <- c("", "","","","","","","","","","","","","","","","","","","","Injuring","PR/Ball/injured")
ggplot(event.rec6a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=266 & PuntId=2902")

event.inj6a <- subset(NGS.2016.reg.wk12to17, GameKey==266 & PlayID==2902 & Time=="2016-12-11 20:30:37.600")
ggplot(event.inj6a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj6a <- event.inj6a[order(event.inj6a$x),] 
event.inj6a$Team <- c("","","", "", "","","","","","","","","","","","","","","defense","offense","defense","offense")
event.inj6a$Event <- c("", "","","","","","","","","","","","","","","","","","","","Injuring","PR/Ball/injured")
ggplot(event.inj6a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=266 & PuntId=2902")

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=280, PlayID=3746)
event.punt7a <- subset(NGS.2016.reg.wk12to17, GameKey==280 & PlayID==3746 & Event=="punt")
ggplot(event.punt7a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=20 & PuntId=258") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec7a <- subset(NGS.2016.reg.wk12to17, GameKey==280 & PlayID==3746 & Event=="punt_received")
ggplot(event.rec7a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj7a <- subset(NGS.2016.reg.wk12to17, GameKey==280 & PlayID==3746 & Time=="2016-12-18 20:55:48.100")
ggplot(event.inj7a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#-------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=296, PlayId=2667)
# event.2902 <- subset(NGS.2016.reg.wk12to17, GameKey==296 & PlayID==2667)
event.punt8a <- subset(NGS.2016.reg.wk12to17, GameKey==296 & PlayID==2667 & Event=="punt")
event.punt8a <- event.punt8a[order(event.punt2$x),] 
ggplot(event.punt8a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=296 & PuntId=2667") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec8a <- subset(NGS.2016.reg.wk12to17, GameKey==296 & PlayID==2667 & Time=="2016-12-24 19:59:47.400")
ggplot(event.rec8a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec8a <- event.rec8a[order(event.rec8a$x),] 
event.rec8a$Team <- c("offense","defense","offense", "defense", "offense","","","","","","","","","","","","","","","","","")
event.rec8a$Event <- c("", "injuring","PR/ball","injured","","","","","","","","","","","","","","","","","","")
ggplot(event.rec8a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=296 & PuntId=2667")

event.inj8a <- subset(NGS.2016.reg.wk12to17, GameKey==296 & PlayID==2667 & Time=="2016-12-24 19:59:47.600")
ggplot(event.inj8a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj8a <- event.inj8a[order(event.inj8a$x),] 
event.inj8a$Team <- c("offense","defense","offense", "defense", "offense","","","","","","","","","","","","","","","","","")
event.inj8a$Event <- c("", "injuring","PR/ball","injured","","","","","","","","","","","","","","","","","","")
ggplot(event.inj8a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=266 & PuntId=2902")

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=357, PlayID=3630)
event.punt9a <- subset(NGS.2017.pre, GameKey==357 & PlayID==3630 & Event=="punt")
ggplot(event.punt9a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=20 & PuntId=258") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec9a <- subset(NGS.2017.pre, GameKey==357 & PlayID==3630 & Event=="punt_received")
ggplot(event.rec9a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec9a <- event.rec9a[order(event.rec9a$x),] 
event.rec9a$Team <- c("","","", "", "","","","","","","","","","","","","","defense","","","","offense")
event.rec9a$Event <- c("", "","","","","","","","","","","","","","","","","injuring","","","","PR/ ball/ injuring")
ggplot(event.rec9a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=357 & PuntId=3630")

event.inj9a <- subset(NGS.2017.pre, GameKey==357 & PlayID==3630 & Time=="2017-08-18 01:39:14.800")
ggplot(event.inj9a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj9a <- event.inj9a[order(event.inj9a$x),] 
event.inj9a$Team <- c("","","", "", "","","","","","","","","defense","defense","","defense","offense","defense","offense","defense","","")
event.inj9a$Event <- c("", "","","","","","","","","","","","","","","","PR/ ball/ injuring","injured","","","","")
ggplot(event.inj9a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=357 & PuntId=3630")
#-----------------------------------------------
# Who was around punt returner at punt and injury (GameKey=384, PlayId=183)
# event.2902 <- subset(NGS.2016.reg.wk12to17, GameKey==296 & PlayID==2667)
event.punt10a <- subset(NGS.2017.pre, GameKey==384 & PlayID==183 & Event=="punt")
event.punt10a <- event.punt10a[order(event.punt2$x),] 
ggplot(event.punt10a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=384 & PuntId=183") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec10a <- subset(NGS.2017.pre, GameKey==384 & PlayID==183 & Event=="punt_received")
ggplot(event.rec10a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec10a <- event.rec10a[order(event.rec10a$x),] 
event.rec10a$Team <- c("offense","","", "", "","","","","","","","","","","","","","","","","","")
event.rec10a$Event <- c("PR/ball", "injured","","","","","","","","","","","injuring","","","","","","","","","")
ggplot(event.rec10a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=384 & PuntId=183")

event.inj10a <- subset(NGS.2017.pre, GameKey==384 & PlayID==183 & Time=="2017-08-31 23:10:42.700")
ggplot(event.inj10a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj10a <- event.inj10a[order(event.inj10a$x),] 
event.inj10a$Team <- c("","","","", "","","defense","offense","","","","","","","","","","","","","","")
event.inj10a$Event <- c("", "","","PR/ball","","","injured","injuring","","","","","","","","","","","","","","")
ggplot(event.inj10a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=384 & PuntId=183")

#-----------------------------------------------
# Who was around punt returner at punt and injury (GameKey=397, PlayId=1526)
# event.2902 <- subset(NGS.2016.pre, GameKey==296 & PlayID==2667)
event.punt11a <- subset(NGS.2017.pre, GameKey==397 & PlayID==1526 & Event=="punt")
event.punt11a <- event.punt11a[order(event.punt2$x),] 
ggplot(event.punt11a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=397 & PuntId=1526") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec11a <- subset(NGS.2017.pre, GameKey==397 & PlayID==1526 & Event=="punt_received")
ggplot(event.rec11a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec11a <- event.rec11a[order(event.rec11a$x),] 
event.rec11a$Team <- c("","","", "", "","","","","","","","","","","","defense","defense","defense","defense","offense","offense","offense")
event.rec11a$Event <- c("","","","","","","","","","","","","","","","injured","","","","","","PR/ball/injuring")
ggplot(event.rec11a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=397 & PuntId=1526")

event.inj11a <- subset(NGS.2017.pre, GameKey==397 & PlayID==1526 & Time=="2017-09-01 03:10:23.200")
ggplot(event.inj11a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj11a <- event.inj11a[order(event.inj11a$x),] 
event.inj11a$Team <- c("","","","", "","","","","","","","","","","","defense","defense","defense","defense","offense","offense","offense")
event.inj11a$Event <- c("", "","","","","","","","","","","","","","","","","injured","","","PR/ball/injuring","")
ggplot(event.inj11a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=397 & PuntId=1526")

#-----------------------------------------------
# Who was around punt returner at punt and injury (GameKey=399, PlayId=3312)
# event.2902 <- subset(NGS.2016.reg.wk12to17, GameKey==296 & PlayID==2667)
event.punt12a <- subset(NGS.2017.reg.wk1to6, GameKey==399 & PlayID==3312 & Event=="punt")
event.punt12a <- event.punt12a[order(event.punt2$x),] 
ggplot(event.punt12a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=399 & PuntId=3312") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec12a <- subset(NGS.2017.reg.wk1to6, GameKey==399 & PlayID==3312 & Event=="punt_received")
ggplot(event.rec12a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec12a <- event.rec12a[order(event.rec12a$x),] 
event.rec12a$Team <- c("offense","defense","offense","offense", "offense","offense","defense","","","","","","","","","","","","","","","")
event.rec12a$Event <- c("","","","PR/ball/injured","","","","","","injuring","","","","","","","","","","","","")
ggplot(event.rec12a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=399 & PuntId=3312")

event.inj12a <- subset(NGS.2017.reg.wk1to6, GameKey==399 & PlayID==3312 & Time=="2017-09-08 03:10:56.800")
ggplot(event.inj12a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj12a <- event.inj12a[order(event.inj12a$x),] 
event.inj12a$Team <- c("","","","","","","offense","defense","defense","defense","defense","defense","offense","","","","","","","","","")
event.inj12a$Event <- c("","","","","","","PR/ball/injured","","","injuring","","","","","","","","","","","","")
ggplot(event.inj12a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=399 & PuntId=3312")

#-----------------------------------------------
# Who was around punt returner at punt and injury (GameKey=473, PlayId=2072)

event.punt13a <- subset(NGS.2017.reg.wk1to6, GameKey==473 & PlayID==2072 & Event=="punt")
event.punt13a <- event.punt13a[order(event.punt2$x),] 
ggplot(event.punt13a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=473 & PuntId=2072") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec13a <- subset(NGS.2017.reg.wk1to6, GameKey==473 & PlayID==2072 & Event=="punt_received")
ggplot(event.rec13a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec13a <- event.rec13a[order(event.rec13a$x),] 
event.rec13a$Team <- c("offense","offense","defense","", "","","","","","","","","","","","","","","","","","")
event.rec13a$Event <- c("PR/ball","","","injured","","","","","","","injuring","","","","","","","","","","","")
ggplot(event.rec13a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=473 & PuntId=2072")

event.inj13a <- subset(NGS.2017.reg.wk1to6, GameKey==473 & PlayID==2072 & Time=="2017-10-08 21:48:30.100")
ggplot(event.inj13a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj13a <- event.inj13a[order(event.inj13a$x),] 
event.inj13a$Team <- c("offense","defense","","","defense","","","","","","","","","","","","","","","","","")
event.inj13a$Event <- c("PR/ball","injured","","","injuring","","","","","","","","","","","","","","","","","")
ggplot(event.inj13a, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("JUST BEFORE INJURY Player Positions for GameKey=473 & PuntId=2072")

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=506, PlayID=1988)
event.2902 <- subset(NGS.2017.reg.wk7to12, GameKey==506 & PlayID==1988)
event.punt14a <- subset(NGS.2017.reg.wk7to12, GameKey==506 & PlayID==1988 & Event=="punt")
ggplot(event.punt14a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=506 & PuntId=1988") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec14a <- subset(NGS.2017.reg.wk7to12, GameKey==506 & PlayID==1988 & Event=="fair_catch")
ggplot(event.rec14a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj14a <- subset(NGS.2017.reg.wk7to12, GameKey==506 & PlayID==1988 & Time=="2017-10-27 01:51:16.400")
ggplot(event.inj14a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=585, PlayID=2208)
event.2902 <- subset(NGS.2017.reg.wk7to12, GameKey==585 & PlayID==2208)
event.punt15a <- subset(NGS.2017.reg.wk12to17, GameKey==585 & PlayID==2208 & Event=="punt")
ggplot(event.punt15a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=585 & PuntId=2208") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec15a <- subset(NGS.2017.reg.wk12to17, GameKey==585 & PlayID==2208 & Event=="punt_received")
ggplot(event.rec15a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj15a <- subset(NGS.2017.reg.wk12to17, GameKey==585 & PlayID==2208 & Time=="2017-12-03 19:51:16.800")
ggplot(event.inj15a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#------------------------------------------------------------------
# Who was around punt returner at punt and injury (GameKey=601, PlayID=602)
event.2902 <- subset(NGS.2017.reg.wk7to12, GameKey==601 & PlayID==602)
event.punt16a <- subset(NGS.2017.reg.wk12to17, GameKey==601 & PlayID==602 & Event=="punt")
ggplot(event.punt16a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=601 & PuntId=602") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec16a <- subset(NGS.2017.reg.wk12to17, GameKey==601 & PlayID==602 & Event=="punt_received")
ggplot(event.rec16a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj16a <- subset(NGS.2017.reg.wk12to17, GameKey==601 & PlayID==602 & Time=="2017-12-10 21:27:20.700")
ggplot(event.inj16a, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------

#---------------------------------------------------------------------------------------------------
# Check non-injury data
#-----------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=415, PlayID=124)
event.punt1b <- subset(NGS.2017.reg.wk1to6, GameKey==415 & PlayID==124 & Event=="punt")
ggplot(event.punt1b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=415 & PuntId=124") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec1b <- subset(NGS.2017.reg.wk1to6, GameKey==415 & PlayID==124 & Event=="punt_received")
ggplot(event.rec1b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj1b <- subset(NGS.2017.reg.wk1to6, GameKey==415 & PlayID==124 & Time=="2017-09-15 00:29:19.200")
ggplot(event.inj1b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=415, PlayID=398)
event.punt2b <- subset(NGS.2017.reg.wk1to6, GameKey==415 & PlayID==398 & Event=="punt")
ggplot(event.punt2b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=415 & PuntId=398") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec2b <- subset(NGS.2017.reg.wk1to6, GameKey==415 & PlayID==398 & Event=="punt_received")
ggplot(event.rec2b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec2b <- event.rec2b[order(event.rec2b$x),] 
event.rec2b$Team <- c("","","","", "","","","","","","","","","","","","","","","","","offense")
event.rec2b$Event <- c("","","","","","","","","","","","","","","","","","","","","","PR/ball")
ggplot(event.rec2b, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=415 & PuntId=398")

event.inj2b <- subset(NGS.2017.reg.wk1to6, GameKey==415 & PlayID==398 & Time=="2017-09-15 00:39:01.200")
ggplot(event.inj2b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.inj2b <- event.inj2b[order(event.inj2b$x),] 
event.inj2b$Team <- c("","","","", "","","","","","","","","","","","","","offense","defense","offense","defense","offense")
event.inj2b$Event <- c("","","","","","","","","","","","","","","","","","","","","","PR/ball")
ggplot(event.inj2b, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("Just AFTER PUNT RECEIVED Player Positions for GameKey=415 & PuntId=398")
#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=416, PlayID=1138)
event.punt3b <- subset(NGS.2017.reg.wk1to6, GameKey==416 & PlayID==1138 & Event=="punt")
ggplot(event.punt3b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=416 & PuntId=1138") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec3b <- subset(NGS.2017.reg.wk1to6, GameKey==416 & PlayID==1138 & Event=="punt_received")
ggplot(event.rec3b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec3b <- event.rec3b[order(event.rec3b$x),] 
event.rec3b$Team <- c("offense","defense","offense","defense", "offense","","","","","","","","","","","","","","","","","")
event.rec3b$Event <- c("PR/ball","","","","","","","","","","","","","","","","","","","","","")
ggplot(event.rec3b, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=416 & PuntId=1138")

event.inj3b <- subset(NGS.2017.reg.wk1to6, GameKey==416 & PlayID==1138 & Time=="2017-09-17 17:47:56.500")
ggplot(event.inj3b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=416, PlayID=1595)
event.punt4b <- subset(NGS.2017.reg.wk1to6, GameKey==416 & PlayID==1595 & Event=="punt")
ggplot(event.punt4b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=416 & PuntId=1595") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec4b <- subset(NGS.2017.reg.wk1to6, GameKey==416 & PlayID==1595 & Event=="punt_received")
ggplot(event.rec4b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec4b <- event.rec4b[order(event.rec4b$x),] 
event.rec4b$Team <- c("","","","", "","","","","","","","","","","","","","","","defense","offense","offense")
event.rec4b$Event <- c("","","","","","","","","","","","","","","","","","","","","","PR/ball")
ggplot(event.rec4b, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=416 & PuntId=1595")

event.inj4b <- subset(NGS.2017.reg.wk1to6, GameKey==416 & PlayID==1595 & Time=="2017-09-17 18:11:48.500")
ggplot(event.inj4b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=417, PlayID=436)
event.punt5b <- subset(NGS.2017.reg.wk1to6, GameKey==417 & PlayID==436 & Event=="punt")
ggplot(event.punt5b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=417 & PuntId=436") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec5b <- subset(NGS.2017.reg.wk1to6, GameKey==417 & PlayID==436 & Event=="punt_received")
ggplot(event.rec5b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj5b <- subset(NGS.2017.reg.wk1to6, GameKey==417 & PlayID==436 & Time=="2017-09-17 17:22:20.900")
ggplot(event.inj5b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=417, PlayID=738)
event.punt6b <- subset(NGS.2017.reg.wk1to6, GameKey==417 & PlayID==738 & Event=="punt")
ggplot(event.punt6b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=417 & PuntId=738") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec6b <- subset(NGS.2017.reg.wk1to6, GameKey==417 & PlayID==738 & Event=="punt_received")
ggplot(event.rec6b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec6b <- event.rec6b[order(event.rec6b$x),] 
event.rec6b$Team <- c("offense","offense","defense","", "","","","","","","","","","","","","","","","","","")
event.rec6b$Event <- c("PR/ball","","","","","","","","","","","","","","","","","","","","","")
ggplot(event.rec6b, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=417 & PuntId=738")

event.inj6b <- subset(NGS.2017.reg.wk1to6, GameKey==417 & PlayID==738 & Time=="2017-09-17 17:37:03.900")
ggplot(event.inj6b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=418, PlayID=581)
event.punt7b <- subset(NGS.2017.reg.wk1to6, GameKey==418 & PlayID==581 & Event=="punt")
ggplot(event.punt7b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=418 & PuntId=581") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec7b <- subset(NGS.2017.reg.wk1to6, GameKey==418 & PlayID==581 & Event=="punt_received")
ggplot(event.rec7b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec7b <- event.rec7b[order(event.rec7b$x),] 
event.rec7b$Team <- c("offense","defense","offense","offense", "offense","offense","defense","","","","","","","","","","","","","","","")
event.rec7b$Event <- c("PR/ball","","","","","","","","","","","","","","","","","","","","","")
ggplot(event.rec7b, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=418 & PuntId=581")

event.inj7b <- subset(NGS.2017.reg.wk1to6, GameKey==418 & PlayID==581 & Time=="2017-09-17 17:22:40.300")
ggplot(event.inj7b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=418, PlayID=1078)
event.punt8b <- subset(NGS.2017.reg.wk1to6, GameKey==418 & PlayID==1078 & Event=="punt")
ggplot(event.punt8b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=418 & PuntId=1078") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec8b <- subset(NGS.2017.reg.wk1to6, GameKey==418 & PlayID==1078 & Event=="punt_received")
ggplot(event.rec8b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj8b <- subset(NGS.2017.reg.wk1to6, GameKey==418 & PlayID==1078 & Time=="2017-09-17 17:49:56.900")
ggplot(event.inj8b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=420, PlayID=1616)
event.punt9b <- subset(NGS.2017.reg.wk1to6, GameKey==420 & PlayID==1616 & Event=="punt")
ggplot(event.punt9b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=420 & PuntId=1616") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec9b <- subset(NGS.2017.reg.wk1to6, GameKey==420 & PlayID==1616 & Event=="punt_received")
ggplot(event.rec9b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj9b <- subset(NGS.2017.reg.wk1to6, GameKey==420 & PlayID==1616 & Time=="2017-09-17 18:11:13.300")
ggplot(event.inj9b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=423, PlayID=3333)
event.punt10b <- subset(NGS.2017.reg.wk1to6, GameKey==423 & PlayID==3333 & Event=="punt")
ggplot(event.punt10b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=423 & PuntId=3333") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec10b <- subset(NGS.2017.reg.wk1to6, GameKey==423 & PlayID==3333 & Event=="punt_received")
ggplot(event.rec10b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj10b <- subset(NGS.2017.reg.wk1to6, GameKey==423 & PlayID==3333 & Time=="2017-09-17 19:32:12.400")
ggplot(event.inj10b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=424, PlayID=3475)
event.punt11b <- subset(NGS.2017.reg.wk1to6, GameKey==424 & PlayID==3475 & Event=="punt")
ggplot(event.punt11b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=424 & PuntId=3475") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec11b <- subset(NGS.2017.reg.wk1to6, GameKey==424 & PlayID==3475 & Event=="punt_received")
ggplot(event.rec11b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj11b <- subset(NGS.2017.reg.wk1to6, GameKey==424 & PlayID==3475 & Time=="2017-09-17 22:41:28.000")
ggplot(event.inj11b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=425, PlayID=139)
event.punt12b <- subset(NGS.2017.reg.wk1to6, GameKey==425 & PlayID==139 & Event=="punt")
ggplot(event.punt12b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=425 & PuntId=139") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec12b <- subset(NGS.2017.reg.wk1to6, GameKey==425 & PlayID==139 & Event=="punt_received")
ggplot(event.rec12b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj12b <- subset(NGS.2017.reg.wk1to6, GameKey==425 & PlayID==139 & Time=="2017-09-17 20:08:49.200")
ggplot(event.inj12b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=426, PlayID=4135)
event.punt13b <- subset(NGS.2017.reg.wk1to6, GameKey==426 & PlayID==4135 & Event=="punt")
ggplot(event.punt13b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=426 & PuntId=4135") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec13b <- subset(NGS.2017.reg.wk1to6, GameKey==426 & PlayID==4135 & Event=="punt_received")
ggplot(event.rec13b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))
event.rec13b <- event.rec13b[order(event.rec13b$x),] 
event.rec13b$Team <- c("","","","", "","","","","","","","","","","","defense","offense","offense","defense","offense","offense","offense")
event.rec13b$Event <- c("","","","","","","","","","","","","","","","","","","","","","PR/ ball")
ggplot(event.rec13b, aes(x=x, y=y, col=Team, shape=Team)) + geom_point(size=4) +
  scale_color_manual(values=c("gray18", "springgreen", "turquoise2")) +
  theme(legend.position="none") +
  geom_text(aes(label=Event, vjust=1.5), size=4) +
  ggtitle("PUNT RECEIVED Player Positions for GameKey=426 & PuntId=4135")

event.inj13b <- subset(NGS.2017.reg.wk1to6, GameKey==426 & PlayID==4135 & Time=="2017-09-18 00:26:14.900")
ggplot(event.inj13b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=427, PlayID=689)
event.punt14b <- subset(NGS.2017.reg.wk1to6, GameKey==427 & PlayID==689 & Event=="punt")
ggplot(event.punt14b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=427 & PuntId=689") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec14b <- subset(NGS.2017.reg.wk1to6, GameKey==427 & PlayID==689 & Event=="punt_received")
ggplot(event.rec14b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj14b <- subset(NGS.2017.reg.wk1to6, GameKey==427 & PlayID==689 & Time=="2017-09-17 20:53:23.700")
ggplot(event.inj14b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=428, PlayID=3878)
event.punt15b <- subset(NGS.2017.reg.wk1to6, GameKey==428 & PlayID==3878 & Event=="punt")
ggplot(event.punt15b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=20, y=10, xend=40, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=428 & PuntId=3878") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec15b <- subset(NGS.2017.reg.wk1to6, GameKey==428 & PlayID==3878 & Event=="punt_received")
ggplot(event.rec15b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj15b <- subset(NGS.2017.reg.wk1to6, GameKey==428 & PlayID==3878 & Time=="2017-09-17 23:12:58.800")
ggplot(event.inj15b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

#--------------------------------------------------------------
# Who was around punt returner at punt and tackle/ end of play (GameKey=429, PlayID=819)
event.punt16b <- subset(NGS.2017.reg.wk1to6, GameKey==429 & PlayID==819 & Event=="punt")
ggplot(event.punt16b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_segment(aes(x=40, y=10, xend=20, yend=10), arrow=arrow(length=unit(0.5,"cm")), color="black")+
  ggtitle("PUNT Player Positions for GameKey=429 & PuntId=819") +
  geom_text(aes(x=30, y=11, label = "Directon to PR Endzone")) +
  geom_text(aes(label=GSISID, vjust=1.5))

event.rec16b <- subset(NGS.2017.reg.wk1to6, GameKey==429 & PlayID==819 & Event=="punt_received")
ggplot(event.rec16b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

event.inj16b <- subset(NGS.2017.reg.wk1to6, GameKey==429 & PlayID==819 & Time=="2017-09-18 01:11:44.300")
ggplot(event.inj16b, aes(x=x, y=y)) + geom_point(size=4)+
  geom_text(aes(label=GSISID, vjust=1.5))

