Learn R Programming

hoopR (version 3.1.0)

bref_players_stats: Basketball-Reference Player Season Stats

Description

Get player season statistics from Basketball-Reference.

Scrapes the league-wide player stat table for a season. No API key is required. Choose the stat table with table. Data is available back to the 1947 (BAA) season for most tables.

Basketball-Reference rate-limits aggressive scraping (~20 requests/minute) -- space repeated calls with Sys.sleep().

Usage

bref_players_stats(season = most_recent_nba_season(), table = "per_game")

Value

A hoopR_data tibble with one row per player (columns vary by table; common identifying columns shown -- column names are Basketball-Reference data-stat keys):

col_nametypesdescription
rankerintegerRow rank.
playercharacterPlayer name.
ageintegerPlayer age on Feb 1 of the season.
team_idcharacterTeam abbreviation (TOT for players on >1 team).
poscharacterPosition.
gintegerGames played.
gsintegerGames started.
mp_per_gnumericMinutes (per_game table) / mp total (totals table).
pts_per_gnumericPoints (scaled to the chosen table).
seasonintegerSeason (echoes the season argument).

The advanced table adds per, ts_pct, usg_pct, ws, bpm, vorp, etc.; totals/per_minute/per_poss return the same box categories scaled accordingly.

Arguments

season

(integer required): Season, in 4-digit ending-year format (e.g. 2024 for the 2023-24 season). Defaults to most_recent_nba_season().

table

(character optional): Which stat table to return. One of per_game (default), totals, advanced, per_minute (per 36 minutes), or per_poss (per 100 possessions).

See Also

Other Basketball-Reference Functions: bref_awards(), bref_draft(), bref_injuries(), bref_player_bios(), bref_player_game_log(), bref_standings(), bref_team_roster(), bref_teams_stats()

Examples

Run this code
# \donttest{
  try(bref_players_stats(season = 2024, table = "per_game"))
# }

Run the code above in your browser using DataLab