build_nflfastR_pbp: Build a Complete nflfastR Data Set

View source: R/build_nflfastR_pbp.R

build_nflfastR_pbpR Documentation

Build a Complete nflfastR Data Set

Description

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.

Usage

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.

Details

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

Value

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

See Also

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

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()
 })




mrcaseb/nflfastR documentation built on March 30, 2024, 10:33 p.m.