{"cells":[{"metadata":{},"cell_type":"markdown","source":"<img src=\"https://www.footballoutsiders.com/images/Guest/Guest-082916-1.jpg\" width=\"700px\">"},{"metadata":{},"cell_type":"markdown","source":"American football, in recent years, has lost some of its popularity but is still the champion of U.S. spectator sports -- picked by 37% of U.S. adults as their favorite sport to watch. The next-most-popular sports are basketball, favored by 11%, and baseball, favored by 9%. ***(https://news.gallup.com/poll/224864/football-americans-favorite-sport-watch.aspx)***\n\nBut, among the “Big 4” North American sports, the NFL has by far the highest game injury rate at 75.4 per 1,000 AEs, (Athlete-exposure (AE)). This means for every 1,000 players playing in a single game, 75.4 will suffer some sort of injury. So in a single game with 92 AEs, you might expect about 75.4 x 92/1,000 = ~7 injuries. Compared to the other Big 4 North American sports, the NFL thus has roughly 4-5 times the in-game injury rate of the NBA, MLB, and NHL. **The combined game and practice regular season injury rate would then be 13.7 per 1,000 AEs**. \n***(https://nflinjuryanalytics.com/2017/06/06/just-how-dangerous-is-the-nfl-vs-other-sports/)***\n\nOn this occasion, the author will dig deeper related to injuries that occurred in 105 players out of 250 players available. Because each player's position has a different role, so what part of the injury most dominates for each player's position, the severity resulting from the injury, and will compare the performance during the match between players who have not suffered injuries, with players who have suffered injuries.\n\n"},{"metadata":{},"cell_type":"markdown","source":"# 1. Process ETL (Extract, Transform, Load) Data"},{"metadata":{},"cell_type":"markdown","source":"**Library Function using in this notebook**"},{"metadata":{"trusted":true,"_kg_hide-output":true,"collapsed":true},"cell_type":"code","source":"library(tidyverse)\nlibrary(ggplot2)\nlibrary(dplyr)\nlibrary(data.table)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Read & Load data file csv to this notebook in R**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"player.track <- fread(\"../input/nfl-playing-surface-analytics/PlayerTrackData.csv\")\nplay.list <- fread(\"../input/nfl-playing-surface-analytics/PlayList.csv\", \n              sep = \",\", header = TRUE, na.strings = \"\")\ninjury.rec <- fread(\"../input/nfl-playing-surface-analytics/InjuryRecord.csv\", \n                       sep = \",\", header = TRUE, na.strings = \"\")\nnames(injury.rec)[names(injury.rec) == \"ï..PlayerKey\"] <- \"PlayerKey\"\nplayer.track$PlayKey <- as.character(player.track$PlayKey)\nplayer.track$event <- as.character(player.track$event)\nplay.list$PlayKey <- as.character(play.list$PlayKey)\nplay.list$GameID <- as.character(play.list$GameID)\nplay.list$RosterPosition <- as.character(play.list$RosterPosition)\nplay.list$StadiumType <- as.character(play.list$StadiumType)\nplay.list$FieldType <- as.character(play.list$FieldType)\nplay.list$Weather <- as.character(play.list$Weather)\nplay.list$PlayType <- as.character(play.list$PlayType)\nplay.list$Position <- as.character(play.list$Position)\nplay.list$PositionGroup <- as.character(play.list$PositionGroup)\ninjury.rec$PlayKey <- as.character(injury.rec$PlayKey)\ninjury.rec$GameID <- as.character(injury.rec$GameID)\ninjury.rec$BodyPart <- as.character(injury.rec$BodyPart)\ninjury.rec$Surface <- as.character(injury.rec$Surface)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"There are several injured players, where the PlayKey is empty. Therefore, an empty PlayKey is filled with the last PlayKey contained in the PlayList table."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"injury.rec[47, \"PlayKey\"] <- \"33337-2-25\"\ninjury.rec[48, \"PlayKey\"] <- \"45099-5-1\"\ninjury.rec[49, \"PlayKey\"] <- \"36591-9-4\"\ninjury.rec[50, \"PlayKey\"] <- \"45950-6-81\"\ninjury.rec[51, \"PlayKey\"] <- \"39653-4-68\"\ninjury.rec[52, \"PlayKey\"] <- \"38253-10-13\"\ninjury.rec[53, \"PlayKey\"] <- \"38214-12-36\"\ninjury.rec[54, \"PlayKey\"] <- \"43119-12-66\"\ninjury.rec[55, \"PlayKey\"] <- \"35648-12-40\"\ninjury.rec[56, \"PlayKey\"] <- \"40051-13-30\"\ninjury.rec[57, \"PlayKey\"] <- \"39671-12-24\"\ninjury.rec[58, \"PlayKey\"] <- \"43229-15-42\"\ninjury.rec[59, \"PlayKey\"] <- \"46021-1-45\"\ninjury.rec[60, \"PlayKey\"] <- \"38259-2-37\"\ninjury.rec[61, \"PlayKey\"] <- \"45158-3-14\"\ninjury.rec[62, \"PlayKey\"] <- \"36572-4-30\"\ninjury.rec[63, \"PlayKey\"] <- \"43490-9-30\"\ninjury.rec[64, \"PlayKey\"] <- \"36573-14-52\"\ninjury.rec[96, \"PlayKey\"] <- \"46134-18-19\"\ninjury.rec[97, \"PlayKey\"] <- \"47196-7-45\"\ninjury.rec[98, \"PlayKey\"] <- \"45975-23-52\"\ninjury.rec[99, \"PlayKey\"] <- \"47273-10-50\"\ninjury.rec[100, \"PlayKey\"] <- \"40405-29-14\"\ninjury.rec[101, \"PlayKey\"] <- \"44423-13-27\"\ninjury.rec[102, \"PlayKey\"] <- \"31933-20-26\"\ninjury.rec[103, \"PlayKey\"] <- \"47285-4-16\"\ninjury.rec[104, \"PlayKey\"] <- \"37068-19-20\"\ninjury.rec[105, \"PlayKey\"] <- \"36696-24-22\"","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 2. Feature Engineering & Imputting\n\n## 2.1 Change Variable in Column & some feature"},{"metadata":{},"cell_type":"markdown","source":"**There are 5 type of weather in common : sunny, cloudy, rainy, snowy, and indoor**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# There are 5 type of weather in common : sunny, cloudy, rainy, snowy, and indoor\nplay.list$Forecasts <- ifelse(\n  play.list$Weather %in% c(\"Clear to Partly Cloudy\", \"cloudy\", \"Cloudy\", \"Cloudy and cold\", \n                           \"Cloudy and Cool\", \"Cloudy, fog started developing in 2nd quarter\", \n                           \"Coudy\", \"Hazy\", \"Mostly cloudy\", \"Mostly Cloudy\", \"Mostly Coudy\", \n                           \"Overcast\", \"Partly clear\", \"Partly cloudy\", \"Partly Cloudy\", \n                           \"Partly Clouidy\", \"Party Cloudy\"), \"Cloudy\",\n  ifelse(\n    play.list$Weather %in% c(\"Indoor\", \"Indoors\", \"N/A (Indoors)\", \"N/A Indoor\"), \"Indoors\",\n    \n    ifelse(\n      play.list$Weather %in% c(\"10% Chance of Rain\", \"30% Chance of Rain\", \n                               \"Cloudy with periods of rain, thunder possible. \n                               Winds shifting to WNW, 10-20 mph.\", \"Cloudy, 50% change of rain\", \n                               \"Cloudy, chance of rain\", \"Cloudy, Rain\", \"Controlled Climate\", \n                               \"Light Rain\", \"Rain\", \"Rain Chance 40%\", \n                               \"Rain likely, temps in low 40s.\", \"Rain shower\", \n                               \"Rainy\", \"Scattered Showers\", \"Showers\"), \"Rainy\",\n      \n      ifelse(\n        play.list$Weather %in% c(\"Cloudy, light snow accumulating 1-3\", \"Cold\", \n                                 \"Heavy lake effect snow\", \"Snow\"), \"Snowy\", \"Sunny\"\n      )\n    )\n  )\n)\n\nplay.list$Weather <- gsub('\"', \"\", play.list$Weather)\nplay.list$Weather <- NULL","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Change Stadium Type in two category, open & closed**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# Change Stadium Type in two category, open & closed\nplay.list$Stadium <- ifelse(\n  play.list$StadiumType %in% c(\"Closed Dome\", \"Dome, closed\", \"Domed, closed\", \"Indoor\", \n                               \"Indoor, Roof Closed\", \"Indoors\", \"Retr. Roof-Closed\", \n                               \"Retr. Roof - Closed\", \"Retr. Roof Closed\"), \"Closed\", \"Open\"\n) \n\nplay.list$StadiumType <- NULL","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Combine InjuryRecord Table with PlayList to get detail information about injury player**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"Player.hist <- left_join(injury.rec, play.list, by = c(\"PlayerKey\", \"GameID\", \"PlayKey\"))\nseverity <- Player.hist %>%\n  mutate(severity.index = rowSums(.[6:9]))\n\nseverity$TeamPosition <- ifelse(\n  severity$Position %in% c(\"SS\", \"OLB\", \"MLB\", \"LB\", \"ILB\", \"FS\", \"DT\", \n                           \"DE\", \"DB\", \"CB\"), \"Defensive\", \"Offensive\" \n) \n\nhead(severity)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 3.EDA (Explanatory Data Analysis)\n\n## 3.1 Plot Graph total Play game Surface & Syntetic"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"play.game <- ggplot(play.list, aes(FieldType, fill = FieldType))\nplay.game + geom_bar(aes(y = (..count..)/sum(..count..)),  \n                    position = position_stack(reverse = TRUE), width = 0.6) +\n  scale_y_continuous(labels=scales::percent) +\n  coord_flip() +\n  geom_text(aes(label = scales::percent((..count..)/sum(..count..)),\n            y= ((..count..)/sum(..count..))), stat = \"count\", position = position_stack(0.95), \n            vjust = -.5, color = \"white\", size = 3.5) +\n  theme(legend.position = \"none\") +\n  theme(axis.text.x = element_text(angle = 0, vjust = 0.5)) +\n  theme(axis.text.y.right = element_text(angle = 30, vjust = 0.7)) +\n  theme(plot.title = element_text(color = \"blue\", size = 13, face = \"bold\"),\n  plot.subtitle = element_text(color = \"red\", size = 10.5, face = \"bold\")) +\n  \n  labs(title = \"Comparison Playing Surface in two season, Syntetic & Natural\", \n       subtitle = \"59% Games, playing in Natural surface\") +\n  labs(x = \"Playing Surface\", y = \"% Total playing\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"play.injury <- ggplot(severity, aes(Surface, fill = Surface))\nplay.injury + geom_bar(aes(y = (..count..)/sum(..count..)),  \n                    position = position_stack(reverse = TRUE), width = 0.6) +\n  scale_y_continuous(labels=scales::percent) +\n  coord_flip() +\n  geom_text(aes(label = scales::percent((..count..)/sum(..count..)),\n            y= ((..count..)/sum(..count..))), stat = \"count\", position = position_stack(0.95), \n            vjust = -.5, color = \"white\", size = 3.5) +\n  theme(legend.position = \"none\") +\n  theme(axis.text.x = element_text(angle = 0, vjust = 0.5)) +\n  theme(axis.text.y.right = element_text(angle = 30, vjust = 0.7)) +\n  theme(plot.title = element_text(color = \"blue\", size = 16, face = \"bold\"),\n  plot.subtitle = element_text(color = \"red\", size = 10.5, face = \"bold\")) +\n\n  labs(title = \"Comparison Injury in Syntetic & Natural\", \n       subtitle = \"54% Majority injury in Synthetic surface\") +\n  labs(x = \"\", y = \"% Total playing\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Although as much as 41.2% of games are played on the synthetic field, injuries to players occur by 54.29% higher than the incidence of injuries in the natural field by 45.71%."},{"metadata":{},"cell_type":"markdown","source":"## 3.2 Body Part Injury"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"Body.field <- ggplot(subset(severity, BodyPart %in% \n                            c(\"Ankle\", \"Foot\", \"Heel\", \"Knee\", \"Toes\")), aes(BodyPart))\n\nBody.field + geom_bar(aes(y = (..count..)/sum(..count..)), \n                      position = \"dodge\", width = 0.6, fill = \"#91bd3a\") + facet_wrap(~ Surface) +\n  \n  scale_fill_gradient(low = \"red\", high = \"white\", limits = c(5,40)) +\n\n  scale_y_continuous(labels=scales::percent) +\n  \n  geom_text(aes(label = scales::percent((..count..)/sum(..count..)), \n            y= ((..count..)/sum(..count..))), stat = \"count\", position = position_stack(0.5), \n            vjust = -.5, color = \"white\", size = 3) +\n  \n  theme(legend.position = \"right\") +\n  theme(axis.text.x = element_text(angle = 0, vjust = 0.5, size = 8)) +\n  theme(axis.text.y.right = element_text(angle = 30, vjust = 0.7, size = 6)) +\n  theme(plot.title = element_text(color = \"blue\", size = 13, face = \"bold\"),\n  plot.subtitle = element_text(color = \"red\", size = 10.5, face = \"bold\")) +\n  \n  labs(title = \"Comparison Injury Body Part in Natural & Synthetic Playing Surface\", \n       subtitle = \"23.8% Ankle injury & 22.9% Knee injury in Synthetic surface\") +\n  labs(x = \"\", y = \"\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Football players can receive injuries to the foot and ankle due to **running**, **side-to-side cutting** or **from direct trauma**, *such as from another player during a tackle*. They should be aware of the following risks: Inversion ankle sprains can damage the ankle ligaments and can also be associated with personal tendon injuries and fractures.\n\nAnkle fractures, metatarsal fractures, Lisfranc fractures and turf toe can sideline athletes and sometimes require surgery.\n\n**Contusions and bone bruises may also result from high impact during tackling. Overuse and excessive training can lead to heel pain (plantar fasciitis), Achilles tendonitis, sesamoiditis, stress fractures, posterior tibial tendonitis (or PTTD) and calcaneal apophysitis in children and adolescents.**"},{"metadata":{},"cell_type":"markdown","source":"## 3.3 Severity Level"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"severity.level <- ggplot(subset(severity, severity.index %in% \n                            c(\"1\", \"2\", \"3\", \"4\")), aes(severity.index))\n\nseverity.level + geom_bar(aes(y = (..count..)/sum(..count..), fill = BodyPart), \n                      position = position_stack(reverse = TRUE), width = 0.6) + \n  facet_wrap(~ Surface) +\n  \n   geom_text(aes(label = scales::percent((..count..)/sum(..count..)), \n            y= ((..count..)/sum(..count..))), stat = \"count\", position = position_stack(1.02), \n            vjust = -.5, color = \"blue\", size = 3) +\n  \n  theme(legend.position = \"bottom\") +\n  theme(axis.text.x = element_text(angle = 0, vjust = 0.5, size = 8)) +\n  theme(axis.text.y.right = element_text(angle = 30, vjust = 0.7, size = 6)) +\n  theme(plot.title = element_text(color = \"blue\", size = 13, face = \"bold\"), \n        plot.subtitle = element_text(color = \"red\", size = 10, face = \"bold\")) +\n  \n  labs(title = \"Severity Injury Body Part in Natural & Synthetic Playing Surface\", \n       subtitle = \"15% DM_M42, signed by index 4, Ankle & Knee injury in Synthetic surface\") +\n  labs(x = \"\", y = \"\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Knee injuries have topped the list in injuries. There are so many moving parts in the knee that can be injured while playing football. The anterior cruciate ligament (ACL) and posterior cruciate ligament (PCL) are commonly affected. Wide receivers and running backs can tear or strain their ACL or PCL by landing too harshly or changing directions abruptly while running. Kickers can suffer from patellar tendonitis, an injury to the connective tissue from the kneecap to the shinbone.\n\nFoot and ankle injuries have increased over the years. These types of injuries can range from a minor pull to a tendon strain to a high ankle sprain. Aside from the obvious (rough physical contact between players), different factors could be contributing to the an increase in foot and ankle injuries. Improvements in shoes and cleats have led to better performance, but they are lighter and less stable than they were decades ago. Players have gotten bigger, stronger and faster. The foot and ankle have to support high levels of traction and friction during play, which translates into force on those areas of the body. *(sources : leonmeadmd)*.\n\nnote : severity.index **1=DM_M1**, **2=DM_M7**, **3=DM_M28**, **4=DM_M42**"},{"metadata":{},"cell_type":"markdown","source":"## 3.4 Position & Severity injury"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"position.injury <- ggplot(subset(severity, Surface %in% \n                            c(\"Natural\", \"Synthetic\")), aes(Surface))\n\nposition.injury + geom_bar(aes(y = (..count..)/sum(..count..), fill = Surface),\n                               position = position_stack(reverse = TRUE), width = 0.75) +\n  \n  facet_wrap(~ TeamPosition) +\n  \n  geom_text(aes(label = scales::percent((..count..)/sum(..count..)), \n            y= ((..count..)/sum(..count..))), stat = \"count\", position = position_stack(0.5), \n            vjust = -.5, color = \"blue\", size = 3.1) +\n  \n  theme(legend.position = \"\") +\n  theme(axis.text.x = element_text(angle = 0, vjust = 0.5, size = 8)) +\n  theme(axis.text.y.right = element_text(angle = 30, vjust = 0.7, size = 6)) +\n  theme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n         plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +\n  \n  labs(title = \"Team Position & Percentage Injury of Body Part in Playing Surface\", \n       subtitle = \"31.4% probability non/contact lower limb injuries, contributed in Synthetic turf\")+\n  labs(x = \"\", y = \"\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"From the graphic data above, it can be concluded that 57.1% risk of injury is more common in defensive positions. And in the next graph it can be seen that the most defensive position players have increased injuries."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"team.injury <- ggplot(subset(severity, Position %in% \n                            c(\"SS\", \"OLB\", \"MLB\", \"LB\", \"ILB\", \"FS\", \"DT\", \n                           \"DE\", \"DB\", \"CB\", \"WR\", \"TE\", \"T\", \"RB\", \"C\")), aes(Position))\n\nteam.injury + geom_bar(aes(y = (..count..)/sum(..count..), fill = BodyPart),\n                               position = position_stack(reverse = TRUE), width = 0.75) +\n  \n  facet_wrap(~ TeamPosition) +\n  \n  geom_text(aes(label = scales::percent((..count..)/sum(..count..)), \n            y= ((..count..)/sum(..count..))), stat = \"count\", position = position_stack(1.02), \n            vjust = -.5, color = \"blue\", size = 2.5) +\n  \n  theme(legend.position = \"bottom\") +\n  theme(axis.text.x = element_text(angle = 0, vjust = 0.5, size = 7)) +\n  theme(axis.text.y.right = element_text(angle = 30, vjust = 0.7, size = 6)) +\n  theme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n         plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +\n  \n  labs(title = \"Team Position & Percentage Injury of Body Part in Playing Surface\", \n       subtitle=\"WR-WideReceiver, CB-CornerBack, OLB-OutsideLinebacker, Ankle-Knee injury majority\")+\n  labs(x = \"\", y = \"\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"In general, players in defensive positions are injured in almost all positions. Top 3 Position with high injury of Body Part :\n\n**WR-Wide Receiver** These are the bolts of the team. the fastest guys on the team no doubt. they line up on the edges of the field near the side lines and when the ball is snapped they run a route hoping that the QB will throw the ball to them to catch at the end of the route. to play in this football positions they usually have long hands and are very athletic so they can jump high and make unbelievable catches. they are the power of the football positions.\n\n**OLB-Outside Linebacker**, they line up against the offence TE and they are responsible for covering the short passes and often use as a blitzing players. they rush from the sides and try to tackle the QB before he can make any play making the offence loose yards and sometimes force a fumble.\n\n**CB-Cornerbacks**, usually two players that line up at the edges of the field against the offence WR . their main job is to stop the WR from completing a pass. they also try to catch passes themselves and intercept the ball. if they see a run play then their job is to contain the runner to the middle of the field so it will be easier to stop him or push him out of bounds to stop the play."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"play.type <- ggplot(subset(severity, PlayType %in% \n                            c(\"Field Goal\", \"Kickoff\", \"Kickoff Not Returned\", \n                              \"Kickoff Returned\", \"Pass\", \"Punt\", \"Punt Not Returned\", \n                              \"Punt Returned\", \"Rush\")), aes(PlayType))\n\nplay.type + geom_bar(aes(y = (..count..)/sum(..count..), fill = TeamPosition),\n                               position = position_stack(reverse = TRUE), width = 0.75) +\n  \n  facet_wrap(~ Surface) +\n  coord_flip() +\n  geom_text(aes(label = scales::percent((..count..)/sum(..count..)), \n            y= ((..count..)/sum(..count..))), stat = \"count\", position = position_stack(1.03), \n            vjust = -.5, color = \"blue\", size = 2.5) +\n  \n  theme(legend.position = \"bottom\") +\n  theme(axis.text.x = element_text(angle = 0, vjust = 0.5, size = 7, face = \"bold\")) +\n  theme(axis.text.y.left = element_text(angle = 0, vjust = 0.7, size = 7)) +\n  theme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n         plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +\n  \n  labs(title = \"Play Type & Percentage Injury of Body Part in Playing Surface\", \n       subtitle = \"25.7% Pass & 14.3% Rush, injury majority in Synthetic turf\")+\n  labs(x = \"\", y = \"\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Rushing**, on offense, is running with the ball when starting from behind the line of scrimmage with an intent of gaining yardage. While this usually means a running play, any offensive play that does not involve a forward pass is a rush - also called a run. It is usually done by the running back after a handoff from the quarterback, although quarterbacks and wide receivers can also rush.\n\n**Pass**, In several forms of football a forward pass is a throwing of the ball in the direction that the offensive team is trying to move, towards the defensive team's goal line."},{"metadata":{},"cell_type":"markdown","source":"## 3.5. Grouping data players don't experience lower limb injuries"},{"metadata":{},"cell_type":"markdown","source":"Now we make a new data frame that contains the historical players non limb injury. Next we will compare the performance between non-injury players and injured players."},{"metadata":{"trusted":true},"cell_type":"code","source":"player.injury <- unlist(data.frame(severity$PlayerKey))\n\nplayer.noninjury <- play.list %>% \n                        select(\"PlayerKey\", \"GameID\", \"PlayKey\", \"RosterPosition\", \"PlayerDay\", \n                               \"PlayerGame\", \"FieldType\", \"PlayType\", \"PlayerGamePlay\", \"Position\", \n                               \"PositionGroup\", \"Stadium\") %>%\n                        filter(!PlayerKey %in% player.injury)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Now we combine table PlayerTrackData to get historical detail track player non injury. In next case, we want to combine performance player non injury and player with injury record experience."},{"metadata":{"trusted":true},"cell_type":"code","source":"#This table combine data.frame player.noninjury and player.track to get information about its tracking\nnoninjury.track <- left_join(player.noninjury, player.track, by = \"PlayKey\")\nnoninjury.track$TeamPosition <- ifelse(noninjury.track$Position %in% \n                                       c(\"CB\", \"DB\", \"DE\", \"DT\", \"FS\", \"ILB\", \"NT\", \"S\", \"SS\", \n                                         \"OLB\", \"MLB\", \"LB\"), \"Defensive\", \n                                       ifelse(noninjury.track$Position %in%\n                                             c(\"K\", \"P\"), \"Specialist\", \"Offensive\"))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Next we will find out the difference in the speed of the players when playing on synthetic turf and on natural turf. This analysis hopes to find something different between synthetic and natural when each player plays on it."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"speed.turf <- noninjury.track %>% \n                    group_by(FieldType, PlayerGame) %>%\n                        summarise_at(vars(s), list(name = mean), na.rm = TRUE)\n\nspeed.plot <- ggplot(speed.turf, aes(x = PlayerGame, y = name, color = FieldType)) +\n                     geom_point()\nspeed.plot + facet_grid(. ~ FieldType) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"Comparison Speed of Player in Synthetic and Natural Turf\", \n     subtitle = \"Average Speed on Synthetic more greater than Natural Turf\")+\nlabs(x = \"PlayerGame\", y = \"Avg.Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The graph above illustrates the average speed of all non-injury players for all positions. The player's running speed greatly affects injuries when a collision occurs between players, or when a player falls during a match. The player's average speed on the Synthetic field is higher than on the Natural field. ***Differences in surface contours and composition of the field***, causing injury to the player at Synthetic more than Natural, especially on ankle and knee injury, part of most injury."},{"metadata":{},"cell_type":"markdown","source":"**Summary Part-1 :**\n1. Although 41% of matches are played on Synthetic turf, 54% of injuries occur in Synthetic turf.\n2. 46% Knee injury - 23% of injuries occur in synthetic turf, and 23% of injuries occur in natural turf. but 40% Ankle injury - 16% of injury in Natural, and 24% in Synthetic turf. ***Overuse and excessive training, high impact during tackling*** is common cause of Ankle and Knee injury. \n3. In Synthetic turf, 33% minor injury(DM_1 & DM_7) and 21% major injury(DM_28 & DM_42). Most major injury occur on Ankle 9.5%, Knee 8.5%, Foot 2%, and Toes 1%.\n4. 57.1% of injuries occur in Defensive positions,and 31.4% injury in Defensive occur in Synthetic turf.\n5. 22% injury occur on WR Player (Offensive), and 57.1% injury in Defensive, injuries occur in almost all positions.\n6. Pass and Rush oment is the most event (73%) which injury occur, but 40% injury occur in Synthetic turf.\n7. The player's average speed on the Synthetic field is higher than on the Natural field. ***Differences in surface contours and composition of the field***, causing injury to the player at Synthetic more than Natural, especially on ankle and knee injury, part of most injury."},{"metadata":{},"cell_type":"markdown","source":"# 3.6 Performance Analysis Injury & Non-Injury Player"},{"metadata":{"trusted":true},"cell_type":"code","source":"performance.noninjury <- noninjury.track %>% \n                    group_by(PlayerGame, Position) %>%\n                        summarise_at(vars(time, dis, s), list(name = mean))\nperformance.noninjury$status <- \"non-injury\"\n\ninjury.track <- left_join(severity, player.track, by = \"PlayKey\")\nperformance.injury <- injury.track %>%\n                    group_by(PlayerGame, Position) %>%\n                        summarise_at(vars(time, dis, s), list(name = mean))\nperformance.injury$status <- \"injury\"\n\nperformance <- merge(performance.noninjury, performance.injury, all = TRUE)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"In the previous explanation, analyze the point \"3.4 Position & Severity injury\", regarding the position that has the most injuries and the severity. There are positions that have suffered the most injuries, as follows (total-position injuries): WR-22%, CB-13%, OLB-13%, RB-9%, DE-7%, and so on can be seen in point 3.4.\n\nThe following analysis will show a comparison of 10 injured player positions, with 10 non-injured players in the same position, by comparing the average time performance, distance (dis), and speed (s) during the game. It is expected that the following data can describe the general physical performance before and or during the match against player-non-injury with player-injury.  "},{"metadata":{},"cell_type":"markdown","source":"**For Example, WR - WIDE RECEIVER**\n\nWR most often experience the risk of injury to the Ankle, knee, and toes. For the following 3 performance comparisons:\n1. **time performance**, non-injury player average 16-18 seconds stable for 32 PlayerGame. Very different from a player who suffered an injury.\n2. **distance (dis) performance**, non-injury player average 0.15-0.17 yards for 32 Player Games. Very different from players who suffered injuries, 0.17-0.35 yards in the range of 32 Player Games.\n3. **speed (s) performance**, non-injury player average 1.5-1.7 yards/s for 32 Player Games.\n\nFrom the three performances above, it can be concluded that WR non-injury players have more stable performance during the match compared to WR-injuries. For the average distance (dis) and speed (s) the injured player is higher above compared to player-non injury, so the player-injury time performance is lower during the game. This greatly affects the player's stamina and focus during the competition due to fatigue."},{"metadata":{},"cell_type":"markdown","source":"**WR-Wide Receiver Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# WR-Wide Receiver Performance in time, speed, and distance\nWR.timeplot <- ggplot(subset(performance, Position == \"WR\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nWR.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"WR Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee, Ankle, and Toes\")+\nlabs(x = \"PlayerGame\", y = \"time\")\n\nWR.displot <- ggplot(subset(performance, Position == \"WR\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nWR.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"Player Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.15-0.17 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nWR.splot <- ggplot(subset(performance, Position == \"WR\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nWR.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"Player Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.5-1.7 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**CB-Corner Back Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# CB-Corner Back Performance in time, speed, and distance\nCB.timeplot <- ggplot(subset(performance, Position == \"CB\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nCB.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"CB-Corner Back Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Ankle and Knee\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nCB.displot <- ggplot(subset(performance, Position == \"CB\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nCB.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) + \n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"CB-Corner Back Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.15-0.17 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nCB.splot <- ggplot(subset(performance, Position == \"CB\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nCB.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"CB-Corner Back Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.5-1.6 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**OLB-Outside Line Back Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# OLB-Outside Line Back Performance in time, speed, and distance\nOLB.timeplot <- ggplot(subset(performance, Position == \"OLB\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nOLB.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"OLB-Outside Line Back Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee and Ankle\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nOLB.displot <- ggplot(subset(performance, Position == \"OLB\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nOLB.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"OLB-Outside Line Back Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.12-0.15 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nOLB.splot <- ggplot(subset(performance, Position == \"OLB\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nOLB.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"OLB-Outside Line Back Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.2-1.4 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**RB-Running Back Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# RB-Running Back Performance in time, speed, and distance\nRB.timeplot <- ggplot(subset(performance, Position == \"RB\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nRB.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"RB-Running Back Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee and Ankle\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nRB.displot <- ggplot(subset(performance, Position == \"RB\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nRB.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"RB-Running Back Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.13-0.15 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nRB.splot <- ggplot(subset(performance, Position == \"RB\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nRB.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"RB-Running Back Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.2-1.5 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**DE-Defensive End Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# DE-Defensive End Performance in time, speed, and distance\nDE.timeplot <- ggplot(subset(performance, Position == \"DE\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nDE.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"DE-Defensive End Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee, Ankle, and Toes\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nDE.displot <- ggplot(subset(performance, Position == \"DE\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nDE.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"DE-Defensive End Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.11-0.13 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nDE.splot <- ggplot(subset(performance, Position == \"DE\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nDE.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"DE-Defensive End Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.0-1.3 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**SS-Strong Safety Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# SS-Strong Safety Performance in time, speed, and distance\nSS.timeplot <- ggplot(subset(performance, Position == \"SS\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nSS.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"SS-Strong Safety Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee and Ankle\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nSS.displot <- ggplot(subset(performance, Position == \"SS\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nSS.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"SS-Strong Safety Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.15-0.17 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nSS.splot <- ggplot(subset(performance, Position == \"SS\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nSS.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"SS-Strong Safety Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.4-1.6 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**FS-Free Safety Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# FS-Free Safety Performance in time, speed, and distance\nFS.timeplot <- ggplot(subset(performance, Position == \"FS\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nFS.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"FS-Free Safety Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee, Ankle, and Toes\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nFS.displot <- ggplot(subset(performance, Position == \"FS\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nFS.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"FS-Free Safety Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.16-0.17 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nFS.splot <- ggplot(subset(performance, Position == \"FS\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nFS.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"FS-Free Safety Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.4-1.5 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**TE-Tight End Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# TE-Tight End Performance in time, speed, and distance\nTE.timeplot <- ggplot(subset(performance, Position == \"TE\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nTE.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"TE-Tight End Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee, Ankle, and Foot\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nTE.displot <- ggplot(subset(performance, Position == \"TE\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nTE.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"TE-Tight End Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.13-0.16 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nTE.splot <- ggplot(subset(performance, Position == \"TE\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nTE.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"TE-Tight End Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.3-1.5 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**MLB-Middle Line Backer Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# MLB-Middle Line Backer Performance in time, speed, and distance\nMLB.timeplot <- ggplot(subset(performance, Position == \"MLB\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nMLB.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"MLB-Middle Line Backer Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Knee, and Ankle\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nMLB.displot <- ggplot(subset(performance, Position == \"MLB\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nMLB.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"MLB-Middle Line Backer Performance in Distance since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.12-0.13 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nMLB.splot <- ggplot(subset(performance, Position == \"MLB\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nMLB.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"MLB-Middle Line Backer Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 1.2-1.3 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**C-Center Performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# C-Center Performance in time, speed, and distance\nC.timeplot <- ggplot(subset(performance, Position == \"C\"), \n                        aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nC.timeplot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"C-Center Performance in time, speed & distance\", \n     subtitle = \"Majority injury in Ankle, and Foot\") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nC.displot <- ggplot(subset(performance, Position == \"C\"), \n                        aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nC.displot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"C-Center Performance in Distance Area since PlayerGame\", \n     subtitle = \"Avg.Distance non-injury 0.07-0.095 yards\") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nC.splot <- ggplot(subset(performance, Position == \"C\"), \n                        aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nC.splot + facet_grid(. ~ Position) +\ngeom_smooth(method = lm) +\n\ntheme(legend.position = \"bottom\") +\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"C-Center Performance in Speed since PlayerGame\", \n     subtitle = \"Avg.Speed non-injury 0.6-1.0 yards/s\") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**All Position performance in time, speed, and distance**"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"# All Position performance in time, speed, and distance \nall.timeplot <- ggplot(performance, aes(x = PlayerGame, y = time_name, color = status)) +\n                        geom_point()\nall.timeplot + \nfacet_grid(. ~ status) +\ntheme(legend.position = \"bottom\") +\ngeom_smooth(method = lm) +\n\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"Average Performance All Player in time, speed & distance\", \n     subtitle = \"Time Performance(second), Non-Injury Player & Injury Player \") +\nlabs(x = \"PlayerGame\", y = \"time\")\n\nall.displot <- ggplot(performance, aes(x = PlayerGame, y = dis_name, color = status)) +\n                        geom_point()\nall.displot + \nfacet_grid(. ~ status) +\ntheme(legend.position = \"bottom\") +\ngeom_smooth(method = lm) +\n\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"Average Performance All Player in time, speed & distance\", \n     subtitle = \"Distance Performance(yards), Non-Injury Player & Injury Player \") +\nlabs(x = \"PlayerGame\", y = \"Distance\")\n\nall.splot <- ggplot(performance, aes(x = PlayerGame, y = s_name, color = status)) +\n                        geom_point()\nall.splot + \nfacet_grid(. ~ status) +\ntheme(legend.position = \"bottom\") +\ngeom_smooth(method = lm) +\n\ntheme(plot.title = element_text(color = \"blue\", size = 13.5, face = \"bold\"), \n      plot.subtitle = element_text(color = \"red\", size = 9, face = \"bold\")) +  \nlabs(title = \"Average Performance All Player in time, speed & distance\", \n     subtitle = \"Speed Performance(yards/s), Non-Injury Player & Injury Player \") +\nlabs(x = \"PlayerGame\", y = \"Speed\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Summary Part-2 (Performance Analysis) :**\n1. **Time Performance**, in general injured players have lower performance during the 32 season (PlayerGame). The duration of injury for a player playing in a game is more higher for non-injury players.\n2. **Distance Performance**, The average running distance of injured players in one game is higher than non-injury players. And more likely to increase for the next session.\n3. **Speed Performance**, in the same case with Distance Performance, speed of injured players in one game is higher than non-injury players. And more likely to increase for the next session.\n4. **The Conclusion** is, 3 factor performance (time, speed, distance) the biggest factor influencing player's stamina. Causes of injury not only occur high impact during tackling, but stamina of each player influence focus during the game. Player stamina can also be reduced during training sessions. So every player must maintain their stamina during the training session, and during the match. **In NFL, the important thing to win the match is effective strategy and player's position during the match.** "},{"metadata":{},"cell_type":"markdown","source":"**Recommendation for NFL :**\n1. Deeper analysis is needed about the contours and composition between synthetic turf and natural turf. Data is concluded that more injuries occur in Synthetic turf compared to Natural turf. A special shoe design for each player is needed to further protect ankle injuries.\n2. Ankle and knee injuries are very high (almost the same as Synthetic & Natural). One of the causes is side-to-side cutting or from direct trauma, such as from another player during a tackle. Tackle opponents is prohibited, especially when opponents run at speeds above 1.7 yards/s. Stopping your opponent can use other part of body rather than feet or head. Ankle & knee injuries can also occur in players who fail to stop the opponent and fall in the wrong position. Because the defensive position also suffered the most injuries and evenly distributed in all lines of players. Knee injuries have topped the list in injuries. There are so many moving parts in the knee that can be injured while playing football. The anterior cruciate ligament (ACL) and posterior cruciate ligament (PCL) are commonly affected. Wide receivers and running backs can tear or strain their ACL or PCL by landing too harshly or changing directions abruptly while running. Kickers can suffer from patellar tendonitis, an injury to the connective tissue from the kneecap to the shinbone.\n3. Pass and Rush moment is the most event (73%) which injury occur. So, it is forbidden to hit, punch, kicking the body above the knee, using the elbow, the head to stop the opponent. Recommend the NFL consider fining and/or suspending players if they encourage targeting another player’s injury during the match.\n4. Causes of injury not only occur high impact during tackling, but stamina of each player influence focus during the game. Player stamina can also be reduced during training sessions. So every player must maintain their stamina during the training session, and during the match. **In NFL, the important thing to win the match is effective strategy, player's position, teamwork during the match.** **So, I think the NFL needs to make a regulation in limiting the duration of physical training that is quite heavy for each player. For example in a week, the maximum duration training that can be done by players is as many as a certain hour (example : 20 hours/week).**\n5. Required a health examination session included in the player's stamina check, for example in running speed test. If the player feels something pain in the knee, ankle or other parts of body, heavier injuries during the competition can be avoided. A regular lower limb health check at least once a month for each player may be needed to see indications of injury so that the doctor can take initial treatment. Players can return to play if there is permission and a recommendation from a doctor. So that the NFL has complete data on injury indications for each player and can be accessed and analyzed by the public or other parties too.\n\nPlease upvote & comment friends :)\n"}],"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}