require(knitr) if (!requireNamespace('pacman')){ install.packages('pacman') } pacman::p_load(dplyr) opts_template$set(stripfigure = list(fig.height = 8, out.width = "95%"))
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.
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 pacman package using the following code: if (!requireNamespace('pacman', quietly = TRUE)){ install.packages('pacman') } pacman::p_load_current_gh("sportsdataverse/hoopR", dependencies = TRUE, update = TRUE)
r hoopR::most_recent_nba_season()
) ~ 1-2 minutestictoc::tic() progressr::with_progress({ nba_pbp <- hoopR::load_nba_pbp() }) tictoc::toc()
glue::glue("{nrow(nba_pbp)} rows of NBA play-by-play data from {length(unique(nba_pbp$game_id))} games.")
r hoopR::most_recent_mbb_season()
) ~ 2-3 minutestictoc::tic() progressr::with_progress({ mbb_pbp <- hoopR::load_mbb_pbp() }) tictoc::toc()
glue::glue("{nrow(mbb_pbp)} rows of men's college basketball play-by-play data from {length(unique(mbb_pbp$game_id))} games.")
For more information on the package and function reference, please see the hoopR
documentation website.
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} }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.