| Title: | nflverse data storage functions |
|---|---|
| Description: | This repository holds automated data releases for nflverse projects and helper functions for managing the uploads. |
| Authors: | Tan Ho [aut, cre] (ORCID: <https://orcid.org/0000-0001-8388-5155>), Sebastian Carl [aut] |
| Maintainer: | Tan Ho <[email protected]> |
| License: | CC BY 4.0 |
| Version: | 0.0.18 |
| Built: | 2026-11-28 11:38:58 UTC |
| Source: | https://github.com/nflverse/nflverse-data |
Download nflverse archive assets with gh cli
.nflverse_download_assets( release_tag, file_type = ".rds", download_dir = tempdir(), repo = "nflverse/nflverse-data" ).nflverse_download_assets( release_tag, file_type = ".rds", download_dir = tempdir(), repo = "nflverse/nflverse-data" )
This functions tries the gh command in a terminal. If it errors, the gh cli isn't available on the machine or at least not on the PATH variable
gh_cli_available()gh_cli_available()
Uploads files to release tag of repo and retries failed uploads.
gh_cli_release_upload( files, tag, ..., repo = "nflverse/nflverse-data", overwrite = TRUE )gh_cli_release_upload( files, tag, ..., repo = "nflverse/nflverse-data", overwrite = TRUE )
files |
vector of file paths to upload |
tag |
release tag |
... |
currently not used |
repo |
repository to upload to, default: |
overwrite |
If |
Replacing an existing release asset (overwrite = TRUE) costs two
requests (delete + upload). Many uploads at the same moment, e.g. from a lot
of parallel workflow jobs, can trigger GitHub's secondary rate limit. After a
rate limit error this function waits at least one minute (as GitHub asks
clients to do), doubling up to 15 minutes, and then uploads only the files
that didn't make it. If the primary rate limit (5,000 requests per hour) is
exhausted, it waits until the limit resets.
The behavior can be configured with environment variables:
NFLVERSE.UPLOAD.INSIST: "false" disables retries.
NFLVERSE.UPLOAD.MAX_TIMES: maximum number of attempts, default 6.
NFLVERSE.UPLOAD.QUIET: "true" silences retry messages.
NFLVERSE.UPLOAD.WRITES_PER_HOUR: optional. If set, pace uploads so this
R session makes no more than this many delete/upload requests per hour.
After an upload, the function waits until the upload's share of the budget
has passed. Unset (the default) means no pacing. Usually limiting the
number of parallel jobs is enough.
invisible TRUE on success, FALSE if there was nothing to upload.
Errors if the upload still fails after the last attempt.
Archive nflverse
nflverse_archive( release_name, archive_tag, ..., file_type = ".rds", repo = "nflverse/nflverse-data" )nflverse_archive( release_name, archive_tag, ..., file_type = ".rds", repo = "nflverse/nflverse-data" )
release_name |
Name of the release. Must be available in |
archive_tag |
The release tag to which data from |
... |
Currently not in use |
file_type |
The file type that should be archived. In most cases this
should be |
repo |
The repo we want to download assets from. |
invisible TRUE after archiving
This functions attaches nflverse attributes like type and timestamp, saves data to a temporary directory in all of csv, rds, and parquet formats, and then uploads to nflverse-data repository for a specified release tag.
nflverse_save( data_frame, file_name, nflverse_type, release_tag, file_types = c("rds", "csv", "parquet", "csv.gz"), repo = "nflverse/nflverse-data", timestamp = TRUE )nflverse_save( data_frame, file_name, nflverse_type, release_tag, file_types = c("rds", "csv", "parquet", "csv.gz"), repo = "nflverse/nflverse-data", timestamp = TRUE )
data_frame |
data_frame to save |
file_name |
file_name to upload as, without the file extension |
nflverse_type |
metadata: name/information to add to data |
release_tag |
name of release to upload to |
file_types |
one or more of |
repo |
repository to upload to, default: |
timestamp |
If |
Upload to nflverse release
nflverse_upload( files, tag, ..., repo = "nflverse/nflverse-data", overwrite = TRUE, timestamp = TRUE )nflverse_upload( files, tag, ..., repo = "nflverse/nflverse-data", overwrite = TRUE, timestamp = TRUE )
files |
vector of filepaths to upload |
tag |
release name |
... |
currently not used |
repo |
repository to upload to, default: |
overwrite |
If |
timestamp |
If |
Uploads timestamp.txt and timestamp.json with the current time to a
release. Use this after uploading several files with timestamp = FALSE.
nflverse_upload_timestamp(tag, ..., repo = "nflverse/nflverse-data")nflverse_upload_timestamp(tag, ..., repo = "nflverse/nflverse-data")
tag |
release name |
... |
currently not used |
repo |
repository to upload to, default: |