Learn R Programming

⚠️There's a newer version (3.1.0) of this package.Take me there.

hoopR

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

Full News on Releases

Follow the SportsDataverse (@SportsDataverse) on X and star this repo

Our Authors

  • Saiem Gilani (@saiemgilani)

Our Contributors (they’re awesome)

  • Jason Lee (@theFirmAISports)

  • Billy Fryer (@_b4billy_)

  • Ross Drucker (@rossdrucker9)

  • Vladislav Shufinskiy (@vshufinskiy)

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}
}

Copy Link

Version

Install

install.packages('hoopR')

Monthly Downloads

1,515

Version

3.0.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Saiem Gilani

Last Published

March 24th, 2026

Functions in hoopR (3.0.0)

.resp_text

Extract response body as text
.kp_get_page

Fetch a KenPom page as parsed HTML using an authenticated cookie jar
clean_team_names_NCAA_merge

Clean KenPom Data Frame Team Names to match NCAA Team Names for easier merging
espn_mbb_conferences

Get ESPN conference names and IDs
espn_mbb_rankings

Get men's college basketball AP and Coaches Poll rankings from ESPN
.v3_to_v2_format

Convert V3 PBP columns to V2-compatible format
.retry_request

Perform an HTTP GET request with retry logic
espn_mbb_game_rosters

Get ESPN men's college basketball game rosters
espn_mbb_pbp

Get ESPN men's college basketball PBP data
espn_mbb_player_stats

Get ESPN men's college basketball player stats data
espn_mbb_game_all

Get ESPN men's college basketball data (Pbp, Team and Player Box)
espn_mbb_betting

Get ESPN MBB's Betting information
espn_mbb_player_box

Get ESPN men's college basketball player box scores
espn_mbb_standings

Get ESPN men's college basketball standings
espn_mbb_scoreboard

Get ESPN men's college basketball schedule for a specific year
espn_mbb_teams

Get ESPN men's college basketball team names and IDs
espn_mbb_wp

Men's College Basketball win probability chart data from ESPN
espn_nba_game_all

Get ESPN NBA game data (Pbp, Team and Player Box)
espn_nba_betting

Get ESPN NBA's Betting information
espn_mbb_team_current_roster

Get ESPN men's college basketball current team roster
espn_mbb_team_stats

Get ESPN men's college basketball team stats data
espn_nba_game_rosters

Get ESPN NBA game rosters
espn_mbb_team_box

Get ESPN men's college basketball team box scores
espn_nba_standings

Get ESPN NBA's Standings
espn_nba_scoreboard

Get ESPN NBA schedule for a specific year
espn_nba_wp

Get NBA win probability chart data from ESPN
espn_nba_team_box

Get ESPN NBA team box scores
espn_nba_pbp

Get ESPN NBA PBP data
espn_nba_player_stats

Get ESPN NBA player stats data
espn_nba_team_stats

Get ESPN NBA team stats data
espn_nba_teams

Get ESPN NBA team names and IDs
espn_nba_team_current_roster

Get ESPN NBA current team roster
espn_nba_player_box

Get ESPN NBA player box scores
helper_espn_mbb_player_box

Parse ESPN MBB Player Box, helper function
hoopR-package

hoopR: Access Men's Basketball Play by Play Data
helper_espn_nba_pbp

Parse ESPN NBA PBP, helper function
helper_espn_mbb_team_box

Parse ESPN MBB Team Box, helper function
helper_espn_nba_team_box

Parse ESPN NBA Team Box, helper function
helper_espn_nba_player_box

Parse ESPN NBA Player Box, helper function
kp_arenas

Get Home Court Arenas
helper_espn_mbb_pbp

Parse ESPN MBB PBP, helper function
kp_coach_history

Get KenPom's coaching resume data
kp_box

Get KenPom Game Box Score
kp_game_attrs

Get Game Attributes
kp_fanmatch

Get FanMatch by date
kp_confhistory

Get KenPom's historical conference ratings
kp_confstats

Get KenPom's conference comparison stats
kp_gameplan

Get KenPom's team game plan page
kp_foul_trouble

Get 2-Foul Participation Stats
kp_height

Get Heights, Experience, Bench and Continuity Data
kp_pointdist

Get Team Points Distribution
kp_playerstats

Get Player Stats Leaders by Metric
kp_pomeroy_archive_ratings

Get KenPom's ratings archive pages
kp_minutes_matrix

Get Minutes Matrix from Expanded Player Page
kp_opptracker

Get KenPom's team opponent tracker page
kp_fourfactors

Get Four Factors Data
kp_officials

Get officials rankings
kp_hca

Get Home Court Advantage Estimates
kp_kpoy

Get KPoY Leaders Tables
kp_efficiency

Get KenPom Efficiency and Tempo Summary
kp_conf

Get KenPom's conference-wide stats
kp_player_career

Get KenPom's player career stats from the player page
kp_trends

Get Division-I statistical trends
kp_pomeroy_ratings

Get KenPom Ratings
kp_referee

Get referee game log
kp_teamstats

Get Team Stats
kp_team_schedule

Get team schedule results
kp_team_lineups

Get Lineups Last 5 Games from Team Page
kp_team_player_stats

Get Team Player Stats
kp_team_depth_chart

Get Depth Chart Last 5 Games from Team Page
kp_program_ratings

Get KenPom's program ratings
load_nba_pbp

Load hoopR NBA play-by-play
load_nba_team_box

Load hoopR NBA team box scores
load_nba_schedule

Load hoopR NBA schedules
load_nba_player_box

Load hoopR NBA player box scores
load_mbb_team_box

Load hoopR men's college basketball team box scores
load_mbb_schedule

Load hoopR men's college basketball schedule
kp_team_history

Get KenPom's team efficiency history
load_mbb_player_box

Load hoopR men's college basketball player box scores
load_mbb_pbp

Load hoopR men's college basketball play-by-play
kp_user_pw

KenPom Login and Password credentials
kp_winprob

Get KenPom Win Probability
kp_team_players

Get KenPom's player stats from the team page
nba_boxscoredefensive

Get NBA Stats API Boxscore Defensive
most_recent_mbb_season

Most Recent Men's College Basketball Season
nba_boxscorefourfactorsv2

Get NBA Stats API Boxscore Four Factors V2
nba_boxscoredefensivev2

Get NBA Stats API Boxscore Defensive V2
nba_assisttracker

Get NBA Stats API Assist Tracker
most_recent_nba_season

Most Recent NBA Season
nba_boxscoreadvancedv2

Get NBA Stats API Boxscore Advanced V2
nba_alltimeleadersgrids

Get NBA Stats API All-time Leaders Grid
nba_assistleaders

Get NBA Stats API Assist Leaders
nba_boxscoreadvancedv3

Get NBA Stats API Boxscore Advanced V3
nba_boxscoremiscv2

Get NBA Stats API Boxscore Misc V2
nba_boxscoreplayertrackv3

Get NBA Stats API Boxscore Player Tracking V3
nba_boxscorescoringv3

Get NBA Stats API Boxscore Scoring V3
nba_boxscorematchups

Get NBA Stats API Boxscore Matchups
nba_boxscorefourfactorsv3

Get NBA Stats API Boxscore Four Factors V3
nba_boxscorematchupsv3

Get NBA Stats API Boxscore Matchups V3
nba_boxscoreplayertrackv2

Get NBA Stats API Boxscore Player Tracking V2
nba_boxscorehustlev2

Get NBA Stats API Boxscore Hustle V2
nba_boxscorescoringv2

Get NBA Stats API Boxscore Scoring V2
nba_boxscoremiscv3

Get NBA Stats API Boxscore Misc V3
nba_boxscoresimilarityscore

Get NBA Stats API Boxscore Similarity Score
nba_boxscoretraditionalv3

Get NBA Stats API Boxscore Traditional V3
nba_boxscoreusagev3

Get NBA Stats API Boxscore Usage V3
nba_commonplayoffseries

Get NBA Stats API Playoff Series
nba_commonallplayers

Get NBA Stats API All Players
nba_boxscoresummaryv3

Get NBA Stats API Boxscore Summary V3
nba_boxscoretraditionalv2

Get NBA Stats API Boxscore Traditional V2
nba_boxscoreusagev2

Get NBA Stats API Boxscore Usage V2
nba_boxscoresummaryv2

Get NBA Stats API Boxscore Summary V2
nba_commonplayerinfo

Get NBA Stats API Player Info
nba_data_pbp

Get NBA Data API Play-by-Play
nba_cumestatsplayer

Get NBA Stats API Cumulative Player Stats
nba_cumestatsteamgames

Get NBA Stats API Cumulative Team Game Stats
nba_defensehub

Get NBA Stats API Defense Hub
nba_commonteamyears

Get NBA Stats API Common Team Years
nba_cumestatsplayergames

Get NBA Stats API Cumulative Player Game Stats
nba_draftcombinedrillresults

Get NBA Stats API Draft Combine Drill Results
nba_commonteamroster

Get NBA Stats API Team Roster
nba_draftboard

Get NBA Stats API Draft Board
nba_cumestatsteam

Get NBA Stats API Cumulative Team Stats
nba_drafthistory

Get NBA Stats API Draft History
nba_draftcombinestats

Get NBA Stats API Draft Combine Stats
nba_franchisehistory

Get NBA Stats API Franchise History
nba_dunkscoreleaders

Get NBA Stats API Dunk Score Leaders
nba_draftcombinespotshooting

Get NBA Stats API Draft Combine - Spot Shooting
nba_franchiseleaders

Get NBA Stats API Franchise Leaders
nba_fantasywidget

Get NBA Stats API Fantasy Widget
nba_franchiseleaderswrank

Get NBA Stats API Franchise Leaders with Rank
nba_draftcombinenonstationaryshooting

Get NBA Stats API Draft Combine Non-Stationary Shooting
nba_draftcombineplayeranthro

Get NBA Stats API Draft Combine Player Anthropological Measurements
nba_leaderstiles

Get NBA Stats API Leaders Tiles
nba_gravityleaders

Get NBA Stats API Gravity Leaders
nba_iststandings

Get NBA Stats API In-Season Tournament Standings
nba_hustlestatsboxscore

Get NBA Stats API Hustle Stats Boxscore
nba_homepageleaders

Get NBA Stats API Homepage Leaders
nba_glalumboxscoresimilarityscore

Get NBA Stats API G-League Alum Boxscore Similarity Score
nba_gamerotation

Get NBA Stats API Game Rotation
nba_homepagev2

Get NBA Stats API HomepageV2 Leaders
nba_infographicfanduelplayer

Get NBA Stats API FanDuel Player Infographic
nba_franchiseplayers

Get NBA Stats API Franchise Players
nba_leaguedashplayerbiostats

Get NBA Stats API League Dashboard Player Biographical Stats
nba_leaguedashplayerclutch

Get NBA Stats API League Dashboard by Player Clutch Splits
nba_leaguedashplayershotlocations

Get NBA Stats API League Dashboard Player Shot Locations
nba_leaguedashplayerstats

Get NBA Stats API League Dashboard Player Stats
nba_leaguedashplayerptshot

Get NBA Stats API League Dashboard Player Tracking - Player Shots
nba_leaguedashptteamdefend

Get NBA Stats API League Dashboard Player Tracking - Team Defense
nba_leaguedashptstats

Get NBA Stats API League Dashboard Player Tracking - Stats
nba_leaguedashlineups

Get NBA Stats API League Dashboard Lineups
nba_leaguedashoppptshot

Get NBA Stats API League Dashboard Player Tracking - Opponent Shots
nba_leaguedashptdefend

Get NBA Stats API League Dashboard Player Tracking - Defense
nba_leaguehustlestatsteam

Get NBA Stats API League Hustle Stats Team
nba_leaguehustlestatsplayerleaders

Get NBA Stats API League Hustle Stats Player Leaders
nba_leaguedashteamshotlocations

Get NBA Stats API League Dashboard Team Shot Locations
nba_leaguehustlestatsteamleaders

Get NBA Stats API League Hustle Stats Team Leaders
nba_leaguedashteamclutch

Get NBA Stats API League Dashboard by Team Clutch Splits
nba_leaguegamefinder

Get NBA Stats API League Game Streak Finder
nba_leaguedashteamptshot

Get NBA Stats API League Dashboard Player Tracking - Team Shots
nba_leaguehustlestatsplayer

Get NBA Stats API League Hustle Stats Player
nba_leaguedashteamstats

Get NBA Stats API League Dashboard Team Stats
nba_leaguegamelog

Get NBA Stats API League Game Log
nba_matchupsrollup

Get NBA Stats API Matchups Rollup
nba_leagueplayerondetails

Get NBA Stats API League Player On/Off Details
nba_leagueseasonmatchups

Get NBA Stats API League Season Matchups
nba_pbp

Get NBA Stats API play-by-play
nba_live_pbp

Get NBA Stats API Live play-by-play
nba_leagueleaders

Get NBA Stats API League Leaders
nba_leaguestandings

Get NBA Stats API League Standings
nba_leaguestandingsv3

Get NBA Stats API League Standings V3
nba_leaguelineupviz

Get NBA Stats API League Lineup Visual Data
nba_live_boxscore

Get NBA Stats API Live Boxscore
nba_playercareerbycollege

Get NBA Stats API Player Career By College
nba_playercareerbycollegerollup

Get NBA Stats API Player Career By College Rollup
nba_playercareerstats

Get NBA Stats API Player Career Stats
nba_playerdashboardbygamesplits

Get NBA Stats API Player Dashboard by Game Splits
nba_playbyplayv3

Get NBA Stats API Play-by-Play V3
nba_playercompare

Get NBA Stats API Player Compare
nba_playerawards

Get NBA Stats API Player Awards
nba_playerdashboardbyclutch

Get NBA Stats API Player Dashboard by Clutch Splits
nba_pbps

Get NBA Stats API play-by-play (Multiple Games)
nba_playerdashboardbygeneralsplits

Get NBA Stats API Player Dashboard by General Splits
nba_playerdashboardbyopponent

Get NBA Stats API Player Dashboard by Opponent
nba_playerestimatedmetrics

Get NBA Stats API Player Estimated Metrics
nba_playerdashboardbyyearoveryear

Get NBA Stats API Player Dashboard Year over Year
nba_playerdashptreb

Get NBA Stats API Player Dashboard Player Tracking - Rebounding
nba_playerdashptshotdefend

Get NBA Stats API Player Dashboard Player Tracking - Defense
nba_playerdashptpass

Get NBA Stats API Player Dashboard Player Tracking - Passing
nba_playerdashboardbylastngames

Get NBA Stats API Player Dashboard by Last N Games
nba_playerdashptshots

Get NBA Stats API Player Dashboard Player Tracking - Shots
nba_playerdashboardbyshootingsplits

Get NBA Stats API Player Dashboard by Shooting Splits
nba_playerdashboardbyteamperformance

Get NBA Stats API Player Dashboard by Team Performance
nba_playerfantasyprofile

Get NBA Stats API Player Fantasy Profile
nba_playerheadshot

Get NBA Stats API Player Head-shot
nba_playergamelog

Get NBA Stats API Player Game Log
nba_playerprofilev2

Get NBA Stats API Player Profile V2
nba_playervsplayer

Get NBA Stats API Player vs Player
nba_playerfantasyprofilebargraph

Get NBA Stats API Player Fantasy Profile Bar Graph
nba_playerindex

Get NBA Stats API Player Index
nba_playergamestreakfinder

Get NBA Stats API Player Game Streak Finder
nba_playernextngames

Get NBA Stats API Player Next N Games
nba_playergamelogs

Get NBA Stats API Player Game Logs
nba_scheduleleaguev2int

Get NBA Stats API International Schedule
nba_scoreboard

Get NBA Stats API Scoreboard
nba_scoreboardv2

Get NBA Stats API Scoreboard V2
nba_synergyplaytypes

Get NBA Stats API Synergy Play Type Stats
nba_shotchartleaguewide

Get NBA Stats API Shot Chart League-Wide
nba_shotchartlineupdetail

Get NBA Stats API Shot Chart for Lineups
nba_scoreboardv3

Get NBA Stats API Scoreboard V3
nba_playoffpicture

Get NBA Stats API Playoff Picture
nba_shotchartdetail

Get NBA Stats API Shot Chart Detail
nba_schedule

Get NBA Stats API Season Schedule
.players_on_court

Add players on court in NBA Stats API play-by-play
.players_on_court_v3

Add players on court in NBA Stats API V3 play-by-play
csv_from_url

Load .csv / .csv.gz file from a remote connection
check_status

Check Status function
.build_player_roster

Build player roster lookup from boxscore data
.kp_headers_list

KenPom headers as a named list (for httr2 req_headers)
.kp_request

Build an httr2 request with KenPom headers and cookie jar