Skip to main content

hoopR

Version-Number R-CMD-check Lifecycle:maturing 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.

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 released version of hoopR from GitHub with:

# You can install using the pacman package using the following code:if (!requireNamespace('pacman', quietly = TRUE)){  install.packages('pacman')}pacman::p_load_current_gh("saiemgilani/hoopR")
# if you would prefer devtools installationif (!requireNamespace('devtools', quietly = TRUE)){  install.packages('devtools')}# Alternatively, using the devtools package:devtools::install_github(repo = "saiemgilani/hoopR")

Quick Start#

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

# You can install using the pacman package using the following code:if (!requireNamespace('pacman', quietly = TRUE)){  install.packages('pacman')}pacman::p_load_current_gh("saiemgilani/hoopR")future::plan("multisession")tictoc::tic()progressr::with_progress({  pbp <- load_nba_pbp(2002:2021)})tictoc::toc()## 66.99 sec elapsedlength(unique(pbp$game_id))nrow(pbp)

Men’s college basketball full play-by-play seasons (2002-2021) ~ 2-3 minutes#

# You can install using the pacman package using the following code:if (!requireNamespace('pacman', quietly = TRUE)){  install.packages('pacman')}pacman::p_load_current_gh("saiemgilani/hoopR")future::plan("multisession")tictoc::tic()progressr::with_progress({  pbp <- load_mbb_pbp(2002:2021)})tictoc::toc()
## 135.87 sec elapsedlength(unique(pbp$game_id))nrow(pbp)

Documentation#

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

Breaking Changes#

Full News on Releases

Our Authors#

Citations#

To cite the hoopR R package in publications, use:

BibTex Citation

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