HoopR
An R package to quickly obtain clean and tidy men's basketball play by play data.
Install / Use
/learn @sportsdataverse/HoopRREADME
hoopR <a href='https://hoopR.sportsdataverse.org/'><img src="https://raw.githubusercontent.com/sportsdataverse/hoopR/main/logo.png" align="right" width="20%" min-width="100px"/></a>
<!-- badges: start --> <!-- badges: end -->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. As of version 1.3.0,
hoopR is also a full NBA
Stats API wrapper with 127 functions added in this release.
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()
## 2.85 sec elapsed
## 519304 rows of NBA play-by-play data from 1069 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()
## 9.94 sec elapsed
## 2902736 rows of men's college basketball play-by-play data from 6246 games.
Documentation
For more information on the package and function reference, please see
the hoopR documentation
website.
Breaking Changes
Follow the SportsDataverse (@SportsDataverse) on X and star this repo
Our Authors
- Saiem Gilani (@saiemgilani) <a href="https://x.com/saiemgilani" target="blank"><img src="https://img.shields.io/twitter/follow/saiemgilani?color=blue&label=%40saiemgilani&logo=x&style=for-the-badge" alt="@saiemgilani" /></a>
<a href="https://github.com/saiemgilani" target="blank"><img src="https://img.shields.io/github/followers/saiemgilani?color=eee&logo=Github&style=for-the-badge" alt="@saiemgilani" /></a>
Our Contributors (they’re awesome)
-
Jason Lee (@theFirmAISports) <a href="https://x.com/theFirmAISports" target="blank"><img src="https://img.shields.io/twitter/follow/theFirmAISports?color=blue&label=%40theFirmAISports&logo=x&style=for-the-badge" alt="@theFirmAISports" /></a> <a href="https://github.com/papagorgio23" target="blank"><img src="https://img.shields.io/github/followers/papagorgio23?color=eee&logo=Github&style=for-the-badge" alt="@papagorgio23" /></a>
-
Billy Fryer (@_b4billy_) <a href="https://x.com/_b4billy_" target="blank"><img src="https://img.shields.io/twitter/follow/_b4billy_?color=blue&label=%40_b4billy_&logo=x&style=for-the-badge" alt="@_b4billy_" /></a> <a href="https://github.com/billyfryer" target="blank"><img src="https://img.shields.io/github/followers/billyfryer?color=eee&logo=Github&style=for-the-badge" alt="@billyfryer" /></a>
-
Ross Drucker (@rossdrucker9) <a href="https://x.com/rossdrucker9" target="blank"><img src="https://img.shields.io/twitter/follow/rossdrucker9?color=blue&label=%40rossdrucker9&logo=x&style=for-the-badge" alt="@rossdrucker9" /></a> <a href="https://github.com/rossdrucker" target="blank"><img src="https://img.shields.io/github/followers/rossdrucker?color=eee&logo=Github&style=for-the-badge" alt="@rossdrucker" /></a>
-
Vladislav Shufinskiy (@vshufinskiy) <a href="https://x.com/vshufinskiy" target="blank"><img src="https://img.shields.io/twitter/follow/vshufinskiy?color=blue&label=%40vshufinskiy&logo=x&style=for-the-badge" alt="@vshufinskiy" /></a> <a href="https://github.com/shufinskiy" target="blank"><img src="https://img.shields.io/github/followers/shufinskiy?color=eee&logo=Github&style=for-the-badge" alt="@shufinskiy" /></a>
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}
}
