Compute Series Conversion Information from Play by Play
Source:R/calculate_series_conversion_rates.R
calculate_series_conversion_rates.Rd
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.
Arguments
- pbp
Play-by-play data as returned by
load_pbp()
,build_nflfastR_pbp()
, orfast_scraper()
.- weekly
If
TRUE
, returns week-by-week stats, otherwise, season-by-season stats in argumentpbp
.
Value
A data frame of series information including the following columns:
- season
The NFL season
- team
NFL team abbreviation
- week
Week if
weekly
isTRUE
- off_n
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")
- off_scr
The rate at which a series ended in either new 1st down or touchdown while the offense was on the field
- off_scr_1st
The rate at which an offense earned a 1st down or scored a touchdown on 1st down
- off_scr_2nd
The rate at which an offense earned a 1st down or scored a touchdown on 2nd down
- off_scr_3rd
The rate at which an offense earned a 1st down or scored a touchdown on 3rd down
- off_scr_4th
The rate at which an offense earned a 1st down or scored a touchdown on 4th down
- off_1st
The rate of series that ended in a new 1st down while the offense was on the field (does not include offensive touchdown)
- off_td
The rate of series that ended in an offensive touchdown while the offense was on the field
- off_fg
The rate of series that ended in a field goal attempt while the offense was on the field
- off_punt
The rate of series that ended in a punt while the offense was on the field
- off_to
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
- def_n
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")
- def_scr
The rate at which a series ended in either new 1st down or touchdown while the defense was on the field
- def_scr_1st
The rate at which a defense allowed a 1st down or touchdown on 1st down
- def_scr_2nd
The rate at which a defense allowed a 1st down or touchdown on 2nd down
- def_scr_3rd
The rate at which a defense allowed a 1st down or touchdown on 3rd down
- def_scr_4th
The rate at which a defense allowed a 1st down or touchdown on 4th down
- def_1st
The rate of series that ended in a new 1st down while the defense was on the field (does not include offensive touchdown)
- def_td
The rate of series that ended in an offensive touchdown while the defense was on the field
- def_fg
The rate of series that ended in a field goal attempt while the defense was on the field
- def_punt
The rate of series that ended in a punt while the defense was on the field
- def_to
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
Examples
# \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)
})
#> Rows: 570
#> Columns: 25
#> $ season <int> 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021…
#> $ team <chr> "ARI", "ARI", "ARI", "ARI", "ARI", "ARI", "ARI", "ARI", "A…
#> $ week <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18,…
#> $ off_n <int> 28, 29, 31, 32, 27, 29, 31, 27, 28, 21, 36, 20, 31, 31, 27…
#> $ off_scr <dbl> 0.7857143, 0.7241379, 0.7419355, 0.8437500, 0.7407407, 0.8…
#> $ off_scr_1st <dbl> 0.1428571, 0.2413793, 0.1935484, 0.1250000, 0.1851852, 0.1…
#> $ off_scr_2nd <dbl> 0.3571429, 0.3448276, 0.4516129, 0.4375000, 0.4444444, 0.3…
#> $ off_scr_3rd <dbl> 0.28571429, 0.10344828, 0.03225806, 0.28125000, 0.11111111…
#> $ off_scr_4th <dbl> 0.00000000, 0.03448276, 0.06451613, 0.00000000, 0.00000000…
#> $ off_1st <dbl> 0.6071429, 0.5862069, 0.6451613, 0.7187500, 0.6666667, 0.6…
#> $ off_td <dbl> 0.17857143, 0.13793103, 0.09677419, 0.12500000, 0.07407407…
#> $ off_fg <dbl> 0.07142857, 0.06896552, 0.03225806, 0.09375000, 0.07407407…
#> $ off_punt <dbl> 0.10714286, 0.13793103, 0.16129032, 0.06250000, 0.14814815…
#> $ off_to <dbl> 0.03571429, 0.06896552, 0.06451613, 0.00000000, 0.03703704…
#> $ def_n <int> 26, 30, 30, 31, 25, 23, 19, 30, 30, 33, 24, 32, 24, 27, 27…
#> $ def_scr <dbl> 0.6538462, 0.7333333, 0.6666667, 0.7741935, 0.6800000, 0.6…
#> $ def_scr_1st <dbl> 0.1923077, 0.2666667, 0.2000000, 0.2580645, 0.2400000, 0.2…
#> $ def_scr_2nd <dbl> 0.2307692, 0.3666667, 0.3666667, 0.3225806, 0.2800000, 0.2…
#> $ def_scr_3rd <dbl> 0.19230769, 0.06666667, 0.06666667, 0.19354839, 0.12000000…
#> $ def_scr_4th <dbl> 0.03846154, 0.03333333, 0.03333333, 0.00000000, 0.04000000…
#> $ def_1st <dbl> 0.5769231, 0.6333333, 0.6000000, 0.7096774, 0.6400000, 0.5…
#> $ def_td <dbl> 0.07692308, 0.10000000, 0.06666667, 0.06451613, 0.04000000…
#> $ def_fg <dbl> 0.03846154, 0.10000000, 0.00000000, 0.09677419, 0.04000000…
#> $ def_punt <dbl> 0.11538462, 0.16666667, 0.20000000, 0.03225806, 0.08000000…
#> $ def_to <dbl> 0.19230769, 0.00000000, 0.13333333, 0.09677419, 0.20000000…
#> Rows: 32
#> Columns: 24
#> $ season <int> 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021…
#> $ team <chr> "ARI", "ATL", "BAL", "BUF", "CAR", "CHI", "CIN", "CLE", "D…
#> $ off_n <int> 510, 439, 538, 568, 474, 471, 568, 463, 540, 449, 463, 504…
#> $ off_scr <dbl> 0.7352948, 0.6786312, 0.7233209, 0.7816675, 0.6573081, 0.6…
#> $ off_scr_1st <dbl> 0.1813308, 0.2027361, 0.2374759, 0.2581515, 0.1996921, 0.2…
#> $ off_scr_2nd <dbl> 0.3010023, 0.2413551, 0.2919777, 0.2785791, 0.2403174, 0.2…
#> $ off_scr_3rd <dbl> 0.2159129, 0.2041508, 0.1571240, 0.2168970, 0.1835548, 0.1…
#> $ off_scr_4th <dbl> 0.03704883, 0.03038920, 0.03674329, 0.02803983, 0.03374375…
#> $ off_1st <dbl> 0.6344701, 0.6090281, 0.6497416, 0.6611931, 0.5935775, 0.6…
#> $ off_td <dbl> 0.10082471, 0.06960312, 0.07357922, 0.12047442, 0.06373052…
#> $ off_fg <dbl> 0.07207742, 0.06303009, 0.07141030, 0.05529971, 0.05945054…
#> $ off_punt <dbl> 0.11400618, 0.14670757, 0.13247227, 0.10024700, 0.16178648…
#> $ off_to <dbl> 0.07862163, 0.11163114, 0.07279657, 0.06278579, 0.12145492…
#> $ def_n <int> 483, 490, 476, 488, 451, 439, 592, 451, 509, 434, 484, 477…
#> $ def_scr <dbl> 0.7069355, 0.7716225, 0.7043671, 0.6497921, 0.6723730, 0.7…
#> $ def_scr_1st <dbl> 0.2331722, 0.2181349, 0.2580480, 0.1802490, 0.2210081, 0.2…
#> $ def_scr_2nd <dbl> 0.2506974, 0.2942446, 0.2548845, 0.2322127, 0.2346056, 0.2…
#> $ def_scr_3rd <dbl> 0.1914793, 0.2320734, 0.1638477, 0.1875192, 0.1908371, 0.2…
#> $ def_scr_4th <dbl> 0.03158668, 0.02716955, 0.02758687, 0.04981106, 0.02592223…
#> $ def_1st <dbl> 0.6182128, 0.6696819, 0.6125357, 0.5754190, 0.5823915, 0.6…
#> $ def_td <dbl> 0.08872267, 0.10194061, 0.09183141, 0.07437307, 0.08998154…
#> $ def_fg <dbl> 0.06194027, 0.05783182, 0.05467296, 0.05611002, 0.07862742…
#> $ def_punt <dbl> 0.13626164, 0.10949656, 0.18223708, 0.18457282, 0.17283118…
#> $ def_to <dbl> 0.09486257, 0.06104911, 0.05872284, 0.10952509, 0.07616840…
# }