Skip to contents

Get per-game team statistics from barttorvik.com.

Pulls one row per team-game for a season (the getgamestats.php export): adjusted and raw offensive/defensive efficiency, the four factors on both ends, tempo, the result, pre-game win probability, and the opposing coach. No API key is required. barttorvik does not publish column headers for this file, so the column names below are mapped from its observed positional layout. Data is available from 2008 to present.

Usage

torvik_game_stats(year = most_recent_mbb_season())

Arguments

year

(integer required): Season, in 4-digit ending-year format (e.g. 2024). Defaults to most_recent_mbb_season().

Value

A hoopR_data tibble with one row per team-game:

col_nametypesdescription
datecharacterGame date (M/D/YY).
typenumericGame-type flag.
teamcharacterTeam name.
confcharacterTeam conference.
oppcharacterOpponent name.
venuecharacterVenue relative to team (H/A/N).
resultcharacterResult string (e.g. L, 78-73).
adj_oenumericAdjusted offensive efficiency.
adj_denumericAdjusted defensive efficiency.
oenumericRaw offensive efficiency (points/100 poss).
off_efgnumericOffensive effective field goal percentage.
off_tonumericOffensive turnover percentage.
off_ornumericOffensive rebound percentage.
off_ftrnumericOffensive free-throw rate.
denumericRaw defensive efficiency (points allowed/100 poss).
def_efgnumericDefensive effective field goal percentage allowed.
def_tonumericDefensive turnover percentage forced.
def_ornumericDefensive (opponent) rebound percentage.
def_ftrnumericDefensive free-throw rate allowed.
game_scorenumericBart Torvik single-game quality score.
opp_confcharacterOpponent conference.
yearintegerSeason (4-digit ending-year).
temponumericGame tempo (possessions).
muidcharacterMatchup unique id.
coachcharacterTeam head coach.
opp_coachcharacterOpponent head coach.
win_probnumericPre-game win probability for team.

Examples

# \donttest{
  try(torvik_game_stats(year = 2024))
#>  2026-06-13 07:39:15.948019: Invalid arguments or no game stats available for 2024!
#>  Args: year = 2024
#>  Error: lexical error: invalid char in json text.                                        <!DOCTYPE HTML PUBLIC "-//W3C//                      (right here) ------^ 
#> data frame with 0 columns and 0 rows
# }