All Projects → nflverse → nflfastR

nflverse / nflfastR

Licence: Unknown, MIT licenses found Licenses found Unknown LICENSE MIT LICENSE.md
A Set of Functions to Efficiently Scrape NFL Play by Play Data

Programming Languages

r
7636 projects
CSS
56736 projects

Projects that are alternatives of or similar to nflfastR

nflreadr
Efficiently download nflverse data
Stars: ✭ 38 (-85.82%)
Mutual labels:  cran, nfl, nflverse
worldfootballR
A wrapper for extracting world football (soccer) data from FBref, Transfermark, Understat and fotmob
Stars: ✭ 188 (-29.85%)
Mutual labels:  cran, football-data, r-package
vosonSML
R package for collecting social media data and creating networks for analysis.
Stars: ✭ 65 (-75.75%)
Mutual labels:  cran, r-package
rcpptoml
Rcpp Bindings to C++ parser for TOML files
Stars: ✭ 26 (-90.3%)
Mutual labels:  cran, r-package
globals
🌐 R package: Identify Global Objects in R Expressions
Stars: ✭ 27 (-89.93%)
Mutual labels:  cran, r-package
rcppcnpy
Rcpp bindings for NumPy files
Stars: ✭ 24 (-91.04%)
Mutual labels:  cran, r-package
football-graphs
Graphs and passing networks in football.
Stars: ✭ 81 (-69.78%)
Mutual labels:  football-data, sports-analytics
thinkr
Some tools for cleaning up messy 'Excel' files to be suitable for R
Stars: ✭ 21 (-92.16%)
Mutual labels:  cran, r-package
oem
Penalized least squares estimation using the Orthogonalizing EM (OEM) algorithm
Stars: ✭ 22 (-91.79%)
Mutual labels:  cran, r-package
apsimx
R package for APSIM-X
Stars: ✭ 30 (-88.81%)
Mutual labels:  cran, r-package
rcppfastfloat
Rcpp Bindings for the 'fastfloat' Header-Only Library
Stars: ✭ 18 (-93.28%)
Mutual labels:  cran, r-package
bruceR
📦 BRoadly Useful Convenient and Efficient R functions that BRing Users Concise and Elegant R data analyses.
Stars: ✭ 110 (-58.96%)
Mutual labels:  cran, r-package
mysportsfeeds-api
Feature requests for the MySportsFeeds Sports Data API.
Stars: ✭ 44 (-83.58%)
Mutual labels:  nfl, football-data
healthyR
Hospital Data Analysis Workflow Tools
Stars: ✭ 21 (-92.16%)
Mutual labels:  cran, r-package
eia
An R package wrapping the US Energy Information Administration open data API.
Stars: ✭ 38 (-85.82%)
Mutual labels:  cran, r-package
RcppEigen
Rcpp integration for the Eigen templated linear algebra library
Stars: ✭ 89 (-66.79%)
Mutual labels:  cran, r-package
sportyR
R package for drawing regulation playing surfaces for several sports
Stars: ✭ 84 (-68.66%)
Mutual labels:  r-package, sports-analytics
rcppmsgpack
MsgPack Headers for R / msgpack.org[R]
Stars: ✭ 17 (-93.66%)
Mutual labels:  cran, r-package
rcppsimdjson
Rcpp Bindings for the 'simdjson' Header Library
Stars: ✭ 103 (-61.57%)
Mutual labels:  cran, r-package
packagefinder
Comfortable search for R packages on CRAN, either directly from the R console or with an R Studio add-in
Stars: ✭ 43 (-83.96%)
Mutual labels:  cran, r-package

nflfastR

CRAN status CRAN downloads Dev status R-CMD-check Lifecycle: stable nflverse support Twitter Follow

nflfastR is a set of functions to efficiently scrape NFL play-by-play data. nflfastR expands upon the features of nflscrapR:

  • The package contains NFL play-by-play data back to 1999
  • As suggested by the package name, it obtains games much faster
  • Includes completion probability (cp), completion percentage over expected (cpoe), and expected yards after the catch (xyac_epa and xyac_mean_yardage) in play-by-play going back to 2006
  • Includes drive information, including drive starting position and drive result
  • Includes series information, including series number and series success
  • Hosts a repository of play-by-play data going back to 1999 for very quick access
  • Features models for Expected Points, Win Probability, Completion Probability, and Yards After the Catch (see section below)
  • Includes a function update_db() that creates and updates a database

We owe a debt of gratitude to the original nflscrapR team, Maksim Horowitz, Ronald Yurko, and Samuel Ventura, without whose contributions and inspiration this package would not exist.

Installation

The easiest way to get nflfastR is to install it from CRAN with:

install.packages("nflfastR")

To get a bug fix or to use a feature from the development version, you can install the development version of nflfastR either from GitHub with:

if (!require("pak")) install.packages("pak")
pak::pak("nflverse/nflfastR")

or prebuilt from the development repo with:

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

Usage

We have provided some application examples in the Getting Started article. However, these require a basic knowledge of R. For this reason we have the nflfastR beginner’s guide, which we recommend to all those who are looking for an introduction to nflfastR with R.

You can find column names and descriptions in the Field Descriptions article, or by accessing the field_descriptions dataframe from the package.

Data repository

Even though nflfastR is very fast, for historical games we recommend downloading the data from here. These data sets include play-by-play data of complete seasons going back to 1999 and we will update them in 2020 once the season starts. The files contain both regular season and postseason data, and one can use game_type or week to figure out which games occurred in the postseason. Data are available as .csv.gz, .parquet, or .rds.

nflfastR models

nflfastR uses its own models for Expected Points, Win Probability, Completion Probability, and Expected Yards After the Catch. To read about the models, please see this post on Open Source Football. For a more detailed description of the motivation for Expected Points models, we highly recommend this paper from the nflscrapR team located here.

Here is a visualization of the Expected Points model by down and yardline.

Here is a visualization of the Completion Probability model by air yards and pass direction.

nflfastR includes two win probability models: one with and one without incorporating the pre-game spread.

Special thanks

  • To Nick Shoemaker for finding and making available JSON-formatted NFL play-by-play back to 1999 (nflfastR uses this source for 1999 and 2000 and previously also used it for 2001-2010)
  • To Lau Sze Yui for developing a scraping function to access JSON-formatted NFL play-by-play beginning in 2001
  • To Aaron Schatz and Football Outsiders for providing charting data to correctly mark scrambles in the 2005 season
  • To Lee Sharpe for curating a resource for game information
  • To Timo Riske, Lau Sze Yui, Sean Clement, and Daniel Houston for many helpful discussions regarding the development of the new nflfastR models
  • To Zach Feldman and Josh Hermsmeyer for many helpful discussions about CPOE models as well as Peter Owen for many helpful suggestions for the CP model
  • To Florian Schmitt for the logo design
  • The many users who found and reported bugs in nflfastR 1.0
  • And of course, the original nflscrapR team, Maksim Horowitz, Ronald Yurko, and Samuel Ventura, whose work represented a dramatic step forward for the state of public NFL research
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].