build_nflfastR_pbp is a convenient wrapper around 6 nflfastR functions:

Please see either the documentation of each function or the nflfastR Field Descriptions website to learn about the output.

build_nflfastR_pbp(
  game_ids,
  source = lifecycle::deprecated(),
  pp = lifecycle::deprecated(),
  ...,
  decode = TRUE,
  rules = TRUE
)

Arguments

game_ids

Vector of character ids or a data frame including the variable game_id (see details for further information).

source

[Deprecated] has no effect and will be removed in a future release.

pp

[Deprecated] has no effect and will be removed in a future release.

...

Additional arguments passed to the scraping functions (for internal use)

decode

If TRUE, the function decode_player_ids() will be executed.

rules

If FALSE, printing of the header and footer in the console output will be suppressed.

Value

An nflfastR play-by-play data frame like it can be loaded from https://github.com/nflverse/nflfastR-data.

Details

To load valid game_ids please use the package function fast_scraper_schedules().

See also

For information on parallel processing and progress updates please see nflfastR.

Examples

# \donttest{ # Build nflfastR pbp for the 2018 and 2019 Super Bowls build_nflfastR_pbp(c("2018_21_NE_LA", "2019_21_SF_KC"))
#> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.1.0.9004 ──
#> 13:22:53 | Start download of 2 games...
#> It is recommended to use parallel processing when trying to load multiple games. #> Please consider running `future::plan("multisession")`! #> Will go on sequentially...
#> 13:22:57 | Download finished. Adding variables...
#> 13:22:57 | added game variables
#> 13:22:57 | added nflscrapR variables
#> 13:22:58 | added ep variables
#> 13:22:58 | added air_yac_ep variables
#> 13:22:59 | added wp variables
#> 13:22:59 | added air_yac_wp variables
#> 13:22:59 | added cp and cpoe
#> 13:22:59 | added fixed drive variables
#> 13:22:59 | added series variables
#> 13:22:59 | Cleaning up play-by-play...
#> 13:22:59 | Cleaning completed
#> 13:22:59 | added qb_epa
#> 13:22:59 | Computing xyac...
#> 13:23:02 | added xyac variables
#> 13:23:02 | Computing xpass...
#> 13:23:02 | added xpass and pass_oe
#> 13:23:02 | Decoding of player ids completed
#> ── DONE ────────────────────────────────────────────────────────────────────────
#> # A tibble: 353 x 370 #> play_id game_id old_game_id home_team away_team season_type week posteam #> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr> #> 1 1 2018_21_NE… 2019020300 LA NE POST 21 NA #> 2 38 2018_21_NE… 2019020300 LA NE POST 21 NE #> 3 67 2018_21_NE… 2019020300 LA NE POST 21 NE #> 4 89 2018_21_NE… 2019020300 LA NE POST 21 NE #> 5 111 2018_21_NE… 2019020300 LA NE POST 21 NE #> 6 133 2018_21_NE… 2019020300 LA NE POST 21 NE #> 7 155 2018_21_NE… 2019020300 LA NE POST 21 NE #> 8 182 2018_21_NE… 2019020300 LA NE POST 21 LA #> 9 204 2018_21_NE… 2019020300 LA NE POST 21 LA #> 10 226 2018_21_NE… 2019020300 LA NE POST 21 LA #> # … with 343 more rows, and 362 more variables: posteam_type <chr>, #> # defteam <chr>, side_of_field <chr>, yardline_100 <dbl>, game_date <chr>, #> # quarter_seconds_remaining <dbl>, half_seconds_remaining <dbl>, #> # game_seconds_remaining <dbl>, game_half <chr>, quarter_end <dbl>, #> # drive <dbl>, sp <dbl>, qtr <dbl>, down <dbl>, goal_to_go <dbl>, time <chr>, #> # yrdln <chr>, ydstogo <dbl>, ydsnet <dbl>, desc <chr>, play_type <chr>, #> # yards_gained <dbl>, shotgun <dbl>, no_huddle <dbl>, qb_dropback <dbl>, #> # qb_kneel <dbl>, qb_spike <dbl>, qb_scramble <dbl>, pass_length <chr>, #> # pass_location <chr>, air_yards <dbl>, yards_after_catch <dbl>, #> # run_location <chr>, run_gap <chr>, field_goal_result <chr>, #> # kick_distance <dbl>, extra_point_result <chr>, two_point_conv_result <chr>, #> # home_timeouts_remaining <dbl>, away_timeouts_remaining <dbl>, #> # timeout <dbl>, timeout_team <chr>, td_team <chr>, td_player_name <chr>, #> # td_player_id <chr>, posteam_timeouts_remaining <dbl>, #> # defteam_timeouts_remaining <dbl>, total_home_score <dbl>, #> # total_away_score <dbl>, posteam_score <dbl>, defteam_score <dbl>, #> # score_differential <dbl>, posteam_score_post <dbl>, #> # defteam_score_post <dbl>, score_differential_post <dbl>, #> # no_score_prob <dbl>, opp_fg_prob <dbl>, opp_safety_prob <dbl>, #> # opp_td_prob <dbl>, fg_prob <dbl>, safety_prob <dbl>, td_prob <dbl>, #> # extra_point_prob <dbl>, two_point_conversion_prob <dbl>, ep <dbl>, #> # epa <dbl>, total_home_epa <dbl>, total_away_epa <dbl>, #> # total_home_rush_epa <dbl>, total_away_rush_epa <dbl>, #> # total_home_pass_epa <dbl>, total_away_pass_epa <dbl>, air_epa <dbl>, #> # yac_epa <dbl>, comp_air_epa <dbl>, comp_yac_epa <dbl>, #> # total_home_comp_air_epa <dbl>, total_away_comp_air_epa <dbl>, #> # total_home_comp_yac_epa <dbl>, total_away_comp_yac_epa <dbl>, #> # total_home_raw_air_epa <dbl>, total_away_raw_air_epa <dbl>, #> # total_home_raw_yac_epa <dbl>, total_away_raw_yac_epa <dbl>, wp <dbl>, #> # def_wp <dbl>, home_wp <dbl>, away_wp <dbl>, wpa <dbl>, vegas_wpa <dbl>, #> # vegas_home_wpa <dbl>, home_wp_post <dbl>, away_wp_post <dbl>, #> # vegas_wp <dbl>, vegas_home_wp <dbl>, total_home_rush_wpa <dbl>, #> # total_away_rush_wpa <dbl>, total_home_pass_wpa <dbl>, #> # total_away_pass_wpa <dbl>, air_wpa <dbl>, …
# It is also possible to directly use the # output of `fast_scraper_schedules` as input library(dplyr, warn.conflicts = FALSE) fast_scraper_schedules(2020) %>% tail(3) %>% build_nflfastR_pbp()
#> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.1.0.9004 ──
#> 13:23:02 | Start download of 3 games...
#> It is recommended to use parallel processing when trying to load multiple games. #> Please consider running `future::plan("multisession")`! #> Will go on sequentially...
#> 13:23:07 | Download finished. Adding variables...
#> 13:23:08 | added game variables
#> 13:23:08 | added nflscrapR variables
#> 13:23:08 | added ep variables
#> 13:23:09 | added air_yac_ep variables
#> 13:23:09 | added wp variables
#> 13:23:10 | added air_yac_wp variables
#> 13:23:10 | added cp and cpoe
#> 13:23:10 | added fixed drive variables
#> 13:23:10 | added series variables
#> 13:23:10 | Cleaning up play-by-play...
#> 13:23:10 | Cleaning completed
#> 13:23:10 | added qb_epa
#> 13:23:10 | Computing xyac...
#> 13:23:13 | added xyac variables
#> 13:23:13 | Computing xpass...
#> 13:23:13 | added xpass and pass_oe
#> 13:23:13 | Decoding of player ids completed
#> ── DONE ────────────────────────────────────────────────────────────────────────
#> # A tibble: 545 x 370 #> play_id game_id old_game_id home_team away_team season_type week posteam #> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr> #> 1 1 2020_20_BU… 2021012401 KC BUF POST 20 NA #> 2 42 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 3 57 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 4 78 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 5 102 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 6 123 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 7 145 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 8 174 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 9 207 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 10 236 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> # … with 535 more rows, and 362 more variables: posteam_type <chr>, #> # defteam <chr>, side_of_field <chr>, yardline_100 <dbl>, game_date <chr>, #> # quarter_seconds_remaining <dbl>, half_seconds_remaining <dbl>, #> # game_seconds_remaining <dbl>, game_half <chr>, quarter_end <dbl>, #> # drive <dbl>, sp <dbl>, qtr <dbl>, down <dbl>, goal_to_go <dbl>, time <chr>, #> # yrdln <chr>, ydstogo <dbl>, ydsnet <dbl>, desc <chr>, play_type <chr>, #> # yards_gained <dbl>, shotgun <dbl>, no_huddle <dbl>, qb_dropback <dbl>, #> # qb_kneel <dbl>, qb_spike <dbl>, qb_scramble <dbl>, pass_length <chr>, #> # pass_location <chr>, air_yards <dbl>, yards_after_catch <dbl>, #> # run_location <chr>, run_gap <chr>, field_goal_result <chr>, #> # kick_distance <dbl>, extra_point_result <chr>, two_point_conv_result <chr>, #> # home_timeouts_remaining <dbl>, away_timeouts_remaining <dbl>, #> # timeout <dbl>, timeout_team <chr>, td_team <chr>, td_player_name <chr>, #> # td_player_id <chr>, posteam_timeouts_remaining <dbl>, #> # defteam_timeouts_remaining <dbl>, total_home_score <dbl>, #> # total_away_score <dbl>, posteam_score <dbl>, defteam_score <dbl>, #> # score_differential <dbl>, posteam_score_post <dbl>, #> # defteam_score_post <dbl>, score_differential_post <dbl>, #> # no_score_prob <dbl>, opp_fg_prob <dbl>, opp_safety_prob <dbl>, #> # opp_td_prob <dbl>, fg_prob <dbl>, safety_prob <dbl>, td_prob <dbl>, #> # extra_point_prob <dbl>, two_point_conversion_prob <dbl>, ep <dbl>, #> # epa <dbl>, total_home_epa <dbl>, total_away_epa <dbl>, #> # total_home_rush_epa <dbl>, total_away_rush_epa <dbl>, #> # total_home_pass_epa <dbl>, total_away_pass_epa <dbl>, air_epa <dbl>, #> # yac_epa <dbl>, comp_air_epa <dbl>, comp_yac_epa <dbl>, #> # total_home_comp_air_epa <dbl>, total_away_comp_air_epa <dbl>, #> # total_home_comp_yac_epa <dbl>, total_away_comp_yac_epa <dbl>, #> # total_home_raw_air_epa <dbl>, total_away_raw_air_epa <dbl>, #> # total_home_raw_yac_epa <dbl>, total_away_raw_yac_epa <dbl>, wp <dbl>, #> # def_wp <dbl>, home_wp <dbl>, away_wp <dbl>, wpa <dbl>, vegas_wpa <dbl>, #> # vegas_home_wpa <dbl>, home_wp_post <dbl>, away_wp_post <dbl>, #> # vegas_wp <dbl>, vegas_home_wp <dbl>, total_home_rush_wpa <dbl>, #> # total_away_rush_wpa <dbl>, total_home_pass_wpa <dbl>, #> # total_away_pass_wpa <dbl>, air_wpa <dbl>, …
# \dontshow{ # Close open connections for R CMD Check future::plan("sequential") # } # }