A "Series" begins on a 1st and 10 and each team attempts to either earn a new 1st down (on offense) or prevent the offense from converting a new 1st down (on defense). Series conversion rate represents how many series have been either converted to a new 1st down or ended in a touchdown. This function computes series conversion rates on offense and defense from nflverse play-by-play data along with other series results. The function automatically removes series that ended in a QB kneel down.
calculate_series_conversion_rates(pbp, weekly = FALSE)
A data frame of series information including the following columns:
The NFL season
NFL team abbreviation
Week if weekly
is TRUE
The number of series the offense played (excludes QB kneel downs, kickoffs, extra point/two point conversion attempts, non-plays, and plays that do not list a "posteam")
The rate at which a series ended in either new 1st down or touchdown while the offense was on the field
The rate at which an offense earned a 1st down or scored a touchdown on 1st down
The rate at which an offense earned a 1st down or scored a touchdown on 2nd down
The rate at which an offense earned a 1st down or scored a touchdown on 3rd down
The rate at which an offense earned a 1st down or scored a touchdown on 4th down
The rate of series that ended in a new 1st down while the offense was on the field (does not include offensive touchdown)
The rate of series that ended in an offensive touchdown while the offense was on the field
The rate of series that ended in a field goal attempt while the offense was on the field
The rate of series that ended in a punt while the offense was on the field
The rate of series that ended in a turnover (including on downs), in an opponent score, or at the end of half (or game) while the offense was on the field
The number of series the defense played (excludes QB kneel downs, kickoffs, extra point/two point conversion attempts, non-plays, and plays that do not list a "posteam")
The rate at which a series ended in either new 1st down or touchdown while the defense was on the field
The rate at which a defense allowed a 1st down or touchdown on 1st down
The rate at which a defense allowed a 1st down or touchdown on 2nd down
The rate at which a defense allowed a 1st down or touchdown on 3rd down
The rate at which a defense allowed a 1st down or touchdown on 4th down
The rate of series that ended in a new 1st down while the defense was on the field (does not include offensive touchdown)
The rate of series that ended in an offensive touchdown while the defense was on the field
The rate of series that ended in a field goal attempt while the defense was on the field
The rate of series that ended in a punt while the defense was on the field
The rate of series that ended in a turnover (including on downs), in an opponent score, or at the end of half (or game) while the defense was on the field
Play-by-play data as returned by load_pbp()
, build_nflfastR_pbp()
, or
fast_scraper()
.
If TRUE
, returns week-by-week stats, otherwise,
season-by-season stats in argument pbp
.
# \donttest{
try({# to avoid CRAN test problems
pbp <- nflfastR::load_pbp(2021)
weekly <- calculate_series_conversion_rates(pbp, weekly = TRUE)
dplyr::glimpse(weekly)
overall <- calculate_series_conversion_rates(pbp, weekly = FALSE)
dplyr::glimpse(overall)
})
# }
Run the code above in your browser using DataLab