Skip to contents

A thin wrapper around the pbpstats API’s “get-wowy-stats” endpoint.

Usage

get_wowy_stats(
  league = "nba",
  season,
  season_type = "Regular Season",
  team_id,
  filter_comparison,
  filter_event,
  filter_value,
  type,
  starter_state = NULL,
  opponent_id = NULL,
  period = NULL,
  from_margin = NULL,
  to_margin = NULL,
  from_time = NULL,
  to_time = NULL,
  leverage = NULL
)

Arguments

league

Character. Which league to query; e.g., "nba" or "wnba"; defaults to "nba".

season

Character or integer. The season to query; e.g., "2024-25".

season_type

Character. One of:

  • "Regular Season"

  • "Playoffs"

  • "PlayIn"

  • "All"

; defaults to "Regular Season".

team_id

Integer or character. The pbpstats ID of the team.

filter_comparison

Character. One of:

  • "Exactly"

  • "GreaterThan"

  • "LessThan"

.

filter_event

Character. One of:

  • "OnFloor"

  • "OffFloor"

  • "PlayedInGame"

  • "DidNotPlayInGame"

  • "Started"

  • "CameOffBench"

.

filter_value

Numeric or character. The value to filter with the specified comparison and event.

type

Character. One of:

  • "Player"

  • "Team"

  • "Lineup"

  • "LineupOpponent"

  • "Opponent"

.

starter_state

Character. One or more starter configurations; one of:

  • "5v5"

  • "4v5"

  • "3v5"

  • "2v5"

  • "1v5"

  • "0v5"

; comma‐separated for multiple values; defaults to NULL.

opponent_id

Integer or character. Optional pbpstats ID of the opponent team; defaults to NULL.

period

Character or integer. One of:

  • "All"

  • "1"

  • "2"

  • "3"

  • "4"

  • "SecondHalf"

; defaults to NULL.

from_margin

Numeric. Optional starting point margin for possessions; defaults to NULL.

to_margin

Numeric. Optional ending point margin for possessions; defaults to NULL.

from_time

Integer. Optional seconds remaining at the start of a possession; defaults to NULL.

to_time

Integer. Optional seconds remaining at the end of a possession; defaults to NULL.

leverage

Character. One or more leverage levels; one of:

  • "VeryLow"

  • "Low"

  • "Medium"

  • "High"

  • "VeryHigh"

; comma‐separated for multiple values; defaults to NULL.

Value

A tibble of WOWY statistics as returned by the API.

Details

Constructs the filter parameter name by combining filter_comparison and filter_event (e.g. ExactlyOnFloor) and sets its value to filter_value. Supply starter_state, opponent_id, period, margins, times, or leverage as needed.

References

Darryl Blackport (2020). PBPStats API, MIT License. https://api.pbpstats.com/docs