The functions build_nflfastR_pbp() and fast_scraper() support loading
raw pbp data from local file systems instead of Github servers.
This function is intended to help setting this up. It loads raw pbp data
and saves it in the given directory split by season in subdirectories.
Usage
save_raw_pbp(
game_ids,
dir = getOption("nflfastR.raw_directory", default = NULL)
)Value
The function returns a data frame with one row for each downloaded file and the following columns:
successif the HTTP request was successfully performed, regardless of the response status code. This isFALSEin case of a network error, or in case you tried to resume from a server that did not support this. A value ofNAmeans the download was interrupted while in progress.status_codethe HTTP status code from the request. A successful download is usually200for full requests or206for resumed requests. Anything else could indicate that the downloaded file contains an error page instead of the requested content.resumefromthe file size before the request, in case a download was resumed.urlfinal url (after redirects) of the request.destfiledownloaded file on disk.errorifsuccess == FALSEthis column contains an error message.typetheContent-Typeresponse header value.modifiedtheLast-Modifiedresponse header value.timetotal elapsed download time for this file in seconds.headersvector with http response headers for the request.
Examples
# \donttest{
# CREATE LOCAL TEMP DIRECTORY
local_dir <- tempdir()
# LOAD AND SAVE A GAME TO TEMP DIRECTORY
save_raw_pbp("2021_20_BUF_KC", dir = local_dir)
#> # A tibble: 1 × 10
#> success status_code resumefrom url destfile error type modified
#> <lgl> <dbl> <dbl> <chr> <chr> <chr> <chr> <dttm>
#> 1 TRUE 200 0 https… /tmp/Rt… NA appl… NA
#> # ℹ 2 more variables: time <dbl>, headers <list>
# REMOVE THE DIRECTORY
unlink(file.path(local_dir, 2021))
# }
