build_nflfastR_pbp function

Build a Complete nflfastR Data Set

Build a Complete nflfastR Data Set

build_nflfastR_pbp is a convenient wrapper around 6 nflfastR functions:

  • fast_scraper()
  • clean_pbp()
  • add_qb_epa()
  • add_xyac()
  • add_xpass()
  • decode_player_ids()

Please see either the documentation of each function or the nflfastR Field Descriptions website

to learn about the output.

build_nflfastR_pbp( game_ids, dir = getOption("nflfastR.raw_directory", default = NULL), ..., 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).
  • dir: Path to local directory (defaults to option "nflfastR.raw_directory") where nflfastR searches for raw game play-by-play data. See save_raw_pbp() for additional information.
  • ...: 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.

Returns

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

Details

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

Examples

# Build nflfastR pbp for the 2018 and 2019 Super Bowls try({# to avoid CRAN test problems build_nflfastR_pbp(c("2018_21_NE_LA", "2019_21_SF_KC")) }) # It is also possible to directly use the # output of `fast_scraper_schedules` as input try({# to avoid CRAN test problems library(dplyr, warn.conflicts = FALSE) fast_scraper_schedules(2020) %>% slice_tail(n = 3) %>% build_nflfastR_pbp() })

See Also

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

  • Maintainer: Ben Baldwin
  • License: MIT + file LICENSE
  • Last published: 2024-11-26