{"cells":[{"metadata":{"_uuid":"1e933e179b751fa2f3f1fa238a5fb82dbbc91e7f"},"cell_type":"markdown","source":"# Introduction\n\nTo help understand the issue and how the NFL looked at the issue of concussions in the Kickoff portion of the play read the NY Times article:\n\n[Will the NFL’s new rules save the kickoff from extinction? The league sure hopes so.](https://www.washingtonpost.com/news/sports/wp/2018/08/16/will-the-nfls-new-rules-save-the-kickoff-from-extinction-the-league-sure-hopes-so/?utm_term=.a3b8426361a1)\n\nSummary of the rule changes that took place in the kickoff:\n- 5 kicking team players line up on each side of kicker \n- Kicking team players must line up within 1 yrd of hte 35 yard line\n- 8 of 11 players on the Recieving team must line up within 10-25 yards of the kickoff zone\n- No wedge formation allowed\n\nThe goal of all these rule changes is generally to reduce speed at which the kicking and recieving team meet each other. For instance preventing kicking team tacklers from getting running start before kickoff, forcing defenders to run with the kicking team (lower relative speed). Also since there is more directional change involved in the kickoff with the new rules, it favors smallers players that can accelerate  and change direction quickly\n\n## Notes about Data from Manual\nData is genreally delivered as two distinct categories, video related data and player position information. The vidoe_footage files contain information that has been entered after review of concussion causing plays. The information contains links to actual videos. The video-footage_control are videos of normal punts without concussions and vidoe_footage-injury are with concussions. The Video data is faily non-standard but each entry has a text description of the play which could provide some NLP oppertunities.\n\nThe NGS (Next Generation Stats) gives player position/speed and orientation data throughout the play. This could be useful in analyzing what sort of players are involved in concussion plays"},{"metadata":{"_uuid":"03d534a447d444fbe444bf3a446edbeff4f4cacf","_execution_state":"idle","trusted":true},"cell_type":"code","source":"library(tidyverse) # metapackage with lots of helpful functions\nlist.files(path = \"../input\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8799985dbb57ee1784dea9e02b8c60431b99eab7"},"cell_type":"code","source":"player.punt.data <- read.csv(\"../input/player_punt_data.csv\")\nplayer.role.data <- read.csv(\"../input/play_player_role_data.csv\")\nplay.info <- read.csv(\"../input/play_information.csv\")\ngame.data <- read.csv('../input/game_data.csv')\nvideo.review <- read.csv('../input/video_review.csv')\nvideo_footage_injury <- read.csv(\"../input/video_footage-injury.csv\")\nvideo_footage_control <- read.csv(\"../input/video_footage-control.csv\")\npaste(\"Number of Punt Concussion incidents: \", dim(video_review)[1])\nhead(video.review)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a0a32142b2373a07d71bdd29279a29095876031b"},"cell_type":"code","source":"head(video_footage_injury)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e2b0aa205d2099d6dd6ca579927f6b28e8a790b2"},"cell_type":"code","source":"paste(\"Total number of games: \", dim(game.data)[1], \"(how lucky)\")\nhead(game.data)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8c22cf03fac5352766d404919192dc1cac9df3c9"},"cell_type":"code","source":"paste(\"Total number of plays: \", dim(play.info)[1])\nhead(play.info)\nplay.info %>% group_by(Play_Type) %>% count()\nplay.info %>% group_by(Season_Year) %>% count()\nplay.info %>% group_by(Season_Type) %>% count()\npaste(\"Portion of Punts during season resulting in concussions: \",  format(dim(video_review)[1]/dim(play.info)[1], digits = 2))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"4bde97e09a2c9924a3caa0db2db4247247b8a784"},"cell_type":"markdown","source":"Note that these plays only illustrate punt plays throughout the 2016/2017 season.  We will explore the NGS data later after exhausing options from these more simplified datastreams"},{"metadata":{"_uuid":"96e8b7e48fe38ce483d44862513aa7d82c6e74e1"},"cell_type":"markdown","source":"# Initial EDA\nIn order to start joining dataframes here we need ot combine the Game Key and the PlayID in order to get unique game/play observations. "},{"metadata":{"trusted":true,"_uuid":"cd8ec87d11ef8d7130e16bb126f43f1fa9708a3b"},"cell_type":"code","source":"colnames(play.info %>% left_join(game.data, by = 'GameKey'))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d8a8af5fc999c974f5a393546650a96ad899fb8b"},"cell_type":"code","source":"video.review$GamePlay <- paste0(video.review$GameKey, \",\", video.review$PlayID)\nplay.info$GamePlay <- paste0(video.review$GameKey, \",\", video.review$PlayID)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3d3b2b9c51370ccf055b179da5af86ef63d104d1"},"cell_type":"code","source":"options(repr.plot.width=6, repr.plot.height=2)\nggplot(video.review, aes(x=Player_Activity_Derived, fill = Primary_Impact_Type))+\n    geom_bar(stat = 'count')+\n    ggtitle(\"Contact Type Resulting in Concussion\")+\n    xlab(NULL)\nvideo.review %>% group_by(Primary_Impact_Type) %>% count()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"49481b3ffce6ff531e469fbd8e0704bb76e4e567"},"cell_type":"markdown","source":"Some immediate observations is that previously known helmet-to-helmet contact results in concussions, but there is an equal number of helmet-to-body concussions, particularly among tackling players. "},{"metadata":{"trusted":true,"_uuid":"40cd3fd1b3ce4db007000e74df0709240248d766"},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"R","language":"R","name":"ir"},"language_info":{"mimetype":"text/x-r-source","name":"R","pygments_lexer":"r","version":"3.4.2","file_extension":".r","codemirror_mode":"r"}},"nbformat":4,"nbformat_minor":1}