NBA play-by-play in two lines
A full NBA season of play-by-play, then a quick look at the league's shot diet.
hoopR ships season-level NBA (and men's college basketball) play-by-play as prebuilt releases. Loading a season is two lines; from there it's ordinary dplyr.
nba_pbp.R
# install.packages("hoopR")
library(hoopR)
library(dplyr)
pbp <- load_nba_pbp(seasons = 2025)
# What does the league's shot diet look like?
pbp |>
filter(shooting_play) |>
count(type_text, sort = TRUE) |>
head(10)Every shooting play carries coordinate_x / coordinate_y, so this is also
the raw material for shot charts. For college hoops, swap in
load_mbb_pbp() — same shape, same columns.
Full docs: hoopR.sportsdataverse.org