Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Series not resetting on punt turnver #144

Closed
ajreinhard opened this issue Dec 3, 2020 · 3 comments · Fixed by #146
Closed

Series not resetting on punt turnver #144

ajreinhard opened this issue Dec 3, 2020 · 3 comments · Fixed by #146
Labels
bug Something isn't working

Comments

@ajreinhard
Copy link

ajreinhard commented Dec 3, 2020

I noticed that it looks like the series field is not resetting when there is a turnover on punt. I provided an example below:

library(tidyverse)

pbp_df <- readRDS(url(paste0('https://raw.githubusercontent.com/guga31bb/nflfastR-data/master/data/play_by_play_2020.rds')))

# Giants recover muffed punt, but play_id = 272 does not become series = 4
pbp_df %>% 
  filter(game_id == '2020_01_PIT_NYG' & series == 3) %>% 
  select(play_id, desc)

# some other examples of series that might also include 2pt attempts or don't reset on punts
pbp_df %>% 
  filter(play_type != 'no_play') %>%
  group_by(game_id, series) %>% 
  summarise(
    plays = sum(play),
    turnover = sum(fumble_lost + interception),
    penalties = sum(penalty),
    two_pt_att = sum(two_point_attempt),
    .groups = 'drop'
  ) %>% 
  arrange(-plays)

EDIT: read through some of issue #130 and it looks like this might be referenced at some point. Disregard if needed, sorry!

@guga31bb
Copy link
Member

guga31bb commented Dec 3, 2020

I was actually curious about this and never looked into it- is there some "official" definition of drive and series and if so, do they re-start after a muffed punt?

@ajreinhard
Copy link
Author

It looks like there actually is!

This situation is referenced explicitly in Rule 7 of the NFL rulebook (see 7-3-1-d). It looks like a scrimmage kick (punt) that has been recovered by the kicking team marks a new series. This is consistent with 3-9-2, which refers to a series as "four consecutive charged scrimmage downs" (3-9-4). A down which includes a "change of possession" is not a charged down.

Changes of possession are mentioned in 3-36-2. Teams can switch between offense and defense mid-down, but do not change from "Team A" (team that put the ball in play) and "Team B".

My interpretation of a drive would be the consecutive scrimmage plays in which a team is "Team A". Drives are not otherwise mentioned.

In the case of the Giants-Steelers game above, the Giants would be starting a new series of downs, but I'd argue that it is not a new drive. All that being said though, I would say I'm more interested in making the fields make sense for data analysis rather than following the rulebook to the letter.

@guga31bb
Copy link
Member

guga31bb commented Dec 3, 2020

Thank you this is extremely helpful and provides more motivation to actually fix it!

@guga31bb guga31bb added the bug Something isn't working label Dec 3, 2020
@guga31bb guga31bb linked a pull request Dec 12, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants