26 open-source packages · R · Python · Node.js · 8 leagues in the warehouse · 120M+ rows of play-by-play · EPA · win probability · ratings models · free and open since 2021

{hoopR} for Men's Basketball

Saiem Gilani

Saiem GilaniMay 8, 2022

2 min read379 words

hoopR

CRAN
status CRAN
downloads Version-Number R-CMD-check Lifecycle:maturing Twitter
Follow Twitter
Follow Contributors

hoopR is an R package for working with men’s basketball data.

The package has functions to access live play by play and box score data from ESPN with shot locations when available. hoopR is also a full NBA Stats API wrapper, exposing well over a hundred endpoints from stats.nba.com alongside the ESPN and loader functions.

It is additionally a scraping and aggregating interface for Ken Pomeroy’s men’s college basketball statistics website, kenpom.com. It provides users with an active subscription the capability to scrape the website tables and analyze the data for themselves.

Installation

You can install the CRAN version of hoopR with:

install.packages("hoopR")

You can install the released version of hoopR from GitHub with:

# You can install using the pak package using the following code:
if (!requireNamespace('pak', quietly = TRUE)){
  install.packages('pak')
}
pak::pak("sportsdataverse/hoopR")

Quick Start

NBA full play-by-play seasons (2002-2026) ~ 1-2 minutes

tictoc::tic()
progressr::with_progress({
  nba_pbp <- hoopR::load_nba_pbp()
})
tictoc::toc()

3.39 sec elapsed

619841 rows of NBA play-by-play data from 1279 games.

Men’s college basketball full play-by-play seasons (2006-2026) ~ 2-3 minutes

tictoc::tic()
progressr::with_progress({
  mbb_pbp <-  hoopR::load_mbb_pbp()
})
tictoc::toc()

10.62 sec elapsed

2915731 rows of men's college basketball play-by-play data from 6275 games.

Documentation

For more information on the package and function reference, please see the hoopR documentation website.

Breaking Changes

Full News on Releases

Follow the SportsDataverse on Twitter and star this repo

Twitter
Follow

GitHub
stars

Our Authors

Our Contributors (they’re awesome)

Citations

To cite the hoopR R package in publications, use:

BibTex Citation

@misc{gilani_2021_hoopR,
  author = {Gilani, Saiem},
  title = {hoopR: The SportsDataverse's R Package for Men's Basketball Data.},
  url = {https://hoopR.sportsdataverse.org},
  year = {2021}
}

Share this post: