GameID Drive down yrdln PlayType sp 2009091000 1 1 22 run 0 2009091000 1 2 25 pass 0 2009091000 1 3 32 sack 0 2009091000 2 1 42 pass 0 2009091000 2 2 44 run 0 2009091000 2 3 43 pass 0 2009091000 2 4 33 Field Goal 1 2009091001 1 1 5 pass 0 2009091001 1 2 10 pass 1
I am to trying determine the probability of scoring either a touchdown and/or a Field Goal based on a given starting yard line. The information given above is very similar to the data frame I am currently using, however there are a few hundred thousand data entries, with thousands of games and multiple drives for each game.
I have been trying to find the first and last row for each drive for each GameID and then determine if a Field Goal or Touchdown was scored at the end of the drive. Ultimately I would like the data organized in a way where each row has game ID, drive, 1st play yrdln, last play yrdln, Field Goal (yes or no), and sp (scoring play). Or hopefully something close to this.
I don't really know where to begin with something like this and have been failing for a good part of a day trying, so any and all help is greatly appreciated. If anything needs further clarification, please let me know!