All Projects → nflverse → nflreadr

nflverse / nflreadr

Licence: Unknown, MIT licenses found Licenses found Unknown LICENSE MIT LICENSE.md
Efficiently download nflverse data

Programming Languages

r
7636 projects
CSS
56736 projects

Projects that are alternatives of or similar to nflreadr

nflfastR
A Set of Functions to Efficiently Scrape NFL Play by Play Data
Stars: ✭ 268 (+605.26%)
Mutual labels:  cran, nfl, nflverse
mysportsfeeds-api
Feature requests for the MySportsFeeds Sports Data API.
Stars: ✭ 44 (+15.79%)
Mutual labels:  nfl, sports-data
scrapeOP
A python package for scraping oddsportal.com
Stars: ✭ 99 (+160.53%)
Mutual labels:  nfl, sports-data
mysportsfeeds-node
NodeJS wrapper for the MySportsFeeds Sports Data API
Stars: ✭ 62 (+63.16%)
Mutual labels:  nfl, sports-data
mysportsfeeds-r
R wrapper functions for the MySportsFeeds Sports Data API
Stars: ✭ 27 (-28.95%)
Mutual labels:  nfl, sports-data
worldfootballR
A wrapper for extracting world football (soccer) data from FBref, Transfermark, Understat and fotmob
Stars: ✭ 188 (+394.74%)
Mutual labels:  cran, sports-data
Randomforestexplainer
A set of tools to understand what is happening inside a Random Forest
Stars: ✭ 175 (+360.53%)
Mutual labels:  cran
Reactr
React for R
Stars: ✭ 227 (+497.37%)
Mutual labels:  cran
Recommenderlab
recommenderlab - Lab for Developing and Testing Recommender Algorithms - R package
Stars: ✭ 174 (+357.89%)
Mutual labels:  cran
Simmer
Discrete-Event Simulation for R
Stars: ✭ 170 (+347.37%)
Mutual labels:  cran
metacoder
Parsing, Manipulation, and Visualization of Metabarcoding/Taxonomic data
Stars: ✭ 120 (+215.79%)
Mutual labels:  cran
migraph
Tools for multimodal and multilevel network analysis
Stars: ✭ 25 (-34.21%)
Mutual labels:  cran
Margins
An R Port of Stata's 'margins' Command
Stars: ✭ 225 (+492.11%)
Mutual labels:  cran
Icd
Fast ICD-10 and ICD-9 comorbidities, decoding and validation in R. NB use main instead of master for default branch.
Stars: ✭ 178 (+368.42%)
Mutual labels:  cran
Littler
A scripting and command-line front-end for GNU R
Stars: ✭ 238 (+526.32%)
Mutual labels:  cran
Checkmate
Fast and versatile argument checks
Stars: ✭ 174 (+357.89%)
Mutual labels:  cran
SpatialPosition
R package for computing spatial position models
Stars: ✭ 30 (-21.05%)
Mutual labels:  cran
Arsenal
An Arsenal of 'R' Functions for Large-Scale Statistical Summaries
Stars: ✭ 171 (+350%)
Mutual labels:  cran
Pacman
A package management tools for R
Stars: ✭ 220 (+478.95%)
Mutual labels:  cran
MALDIquant
Quantitative Analysis of Mass Spectrometry Data
Stars: ✭ 48 (+26.32%)
Mutual labels:  cran

nflreadr

CRAN status Codecov test coverage Dev status Lifecycle: stable R build status nflverse discord

nflreadr is a minimal package for downloading data from nflverse repositories. It includes caching, optional progress updates, and data dictionaries.

Please note that nflverse data repositories have been reorganized and pushed towards the nflverse-data repo, and v1.2.0+ is the minimum version that supports this change. We encourage all users to upgrade to this version immediately.

For Python access to nflverse data, please check out nfl-data-py - maintained by Cooper Adams.

Installation

Install the stable version from CRAN with:

install.packages("nflreadr")

Install the development version from GitHub with:

install.packages("nflreadr", repos = c("https://nflverse.r-universe.dev", getOption("repos")))

# or use remotes/devtools
# install.packages("remotes")
remotes::install_github("nflverse/nflreadr")

Usage

The main functions of nflreadr are prefixed with load_.

library(nflreadr)

load_pbp(2021)
#> ── nflverse play by play data ──────────────────────────────────────────────────
#> ℹ Data updated: 2022-09-27 07:35:02 EDT
#> # A tibble: 50,712 × 372
#>    play_id game_id old_g…¹ home_…² away_…³ seaso…⁴  week posteam poste…⁵ defteam
#>      <dbl> <chr>   <chr>   <chr>   <chr>   <chr>   <int> <chr>   <chr>   <chr>  
#>  1       1 2021_0… 202109… TEN     ARI     REG         1 <NA>    <NA>    <NA>   
#>  2      40 2021_0… 202109… TEN     ARI     REG         1 TEN     home    ARI    
#>  3      55 2021_0… 202109… TEN     ARI     REG         1 TEN     home    ARI    
#>  4      76 2021_0… 202109… TEN     ARI     REG         1 TEN     home    ARI    
#>  5     100 2021_0… 202109… TEN     ARI     REG         1 TEN     home    ARI    
#>  6     122 2021_0… 202109… TEN     ARI     REG         1 TEN     home    ARI    
#>  7     152 2021_0… 202109… TEN     ARI     REG         1 ARI     away    TEN    
#>  8     181 2021_0… 202109… TEN     ARI     REG         1 ARI     away    TEN    
#>  9     218 2021_0… 202109… TEN     ARI     REG         1 ARI     away    TEN    
#> 10     253 2021_0… 202109… TEN     ARI     REG         1 ARI     away    TEN    
#> # … with 50,702 more rows, 362 more variables: 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>, …, and
#> #   abbreviated variable names ¹​old_game_id, ²​home_team, ³​away_team,
#> #   ⁴​season_type, ⁵​posteam_type
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names

load_player_stats(2021)
#> ── nflverse player stats: offense ──────────────────────────────────────────────
#> ℹ Data updated: 2023-01-05 04:08:21 EST
#> # A tibble: 5,698 × 52
#>    player…¹ playe…² playe…³ posit…⁴ posit…⁵ heads…⁶ recen…⁷ season  week seaso…⁸
#>    <chr>    <chr>   <chr>   <chr>   <chr>   <chr>   <chr>    <int> <int> <chr>  
#>  1 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     1 REG    
#>  2 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     2 REG    
#>  3 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     3 REG    
#>  4 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     4 REG    
#>  5 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     5 REG    
#>  6 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     6 REG    
#>  7 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     7 REG    
#>  8 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021     8 REG    
#>  9 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021    10 REG    
#> 10 00-0019… T.Brady Tom Br… QB      QB      https:… TB        2021    11 REG    
#> # … with 5,688 more rows, 42 more variables: completions <int>, attempts <int>,
#> #   passing_yards <dbl>, passing_tds <int>, interceptions <dbl>, sacks <dbl>,
#> #   sack_yards <dbl>, sack_fumbles <int>, sack_fumbles_lost <int>,
#> #   passing_air_yards <dbl>, …, and abbreviated variable names ¹​player_id,
#> #   ²​player_name, ³​player_display_name, ⁴​position, ⁵​position_group,
#> #   ⁶​headshot_url, ⁷​recent_team, ⁸​season_type
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names

Data Sources

Data accessed by this package is stored on GitHub and can typically be found in one of the following repositories:

For a full list of functions, please see the reference page.

This data is maintained by the nflverse project team and is primarily automated via GitHub Actions. You can check the status and schedules page here: https://github.com/nflverse/nflverse-data

Configuration

The following options help configure default nflreadr behaviours.

options(nflreadr.verbose) 
# TRUE/FALSE to silence messages such as cache warnings
options(nflreadr.cache) 
# one of "memory", "filesystem", or "off"
options(nflreadr.prefer) 
# one of "qs", "rds", "parquet", or "csv"
options(nflreadr.download_path)
# defaults to current working directory - change to specify where `nflverse_download()` places data.

You can also configure nflreadr to display progress messages with the progressr package, e.g.

progressr::with_progress(load_rosters(seasons = 2010:2020))
 |========            |  40%

Getting help

The best places to get help on this package are:

Contributing

Many hands make light work! Here are some ways you can contribute to this project:

Terms of Use

The R code for this package is released as open source under the MIT License. NFL data accessed by this package belong to their respective owners, and are governed by their terms of use.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].