Skip to contents

This function gets NBA player stats for the specified seasons returning a data frame. Function pauses for five seconds after each season to prevent timeout issues.

Usage

nba_player_stats(
  seasons,
  season_type = "Regular Season",
  measure_types = NULL,
  return_nested = FALSE
)

Arguments

seasons

A numeric vector of seasons (e.g., 2024) for which to fetch NBA player stats.

season_type

A character string specifying the type of season (default = "Regular Season"). Valid options include:

  • "Pre Season" - Pre Season games.

  • "Regular Season" - Regular Season games.

  • "Playoffs" - Playoff games.

  • "All Star" - All Star games.

  • "IST" - NBA Cup games.

  • "PlayIn" - Play In games.

measure_types

A character vector specifying the types of stats (default = NULL (all measure types)). Valid options include:

  • "Base" - Traditional stats.

  • "Advanced" - Advanced stats.

  • "Usage" - Usage stats.

  • "Misc" - Misc stats.

  • "Scoring" - Scoring stats.

return_nested

A logical value. If FALSE (default), returns a single combined data frame for all seasons. If TRUE, returns a list of data frames, one for each season.

Value

A data frame containing player level stats for specified seasons and measure types.