Skip to contents

A thin wrapper around the pbpstats API’s “get-on-off” endpoint.

Usage

get_on_off(
  league = "nba",
  season,
  season_type = "Regular Season",
  type,
  team_id,
  player_id,
  leverage = NULL,
  stat = 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".

type

Character. Whether to fetch on/off for a "team" or a "player".

team_id

Integer or character. The pbpstats ID of the team (required if type = "team").

player_id

Integer or character. The pbpstats ID of the player (required if type = "player").

leverage

Character. Leverage levels to include; one or more of:

  • "VeryLow"

  • "Low"

  • "Medium"

  • "High"

  • "VeryHigh"

; comma-separated for multiple values.

stat

Character or character vector. Which metric(s) to return. Options include:

  • "Assisted2sPct"

  • "NonPutbacksAssisted2sPct"

  • "Assisted3sPct"

  • "Fg3Pct"

  • "NonHeaveFg3Pct"

  • "Fg2Pct"

  • "EfgPct"

  • "TsPct"

  • "FG3APct"

  • "FG3APctBlocked"

  • "FG2APctBlocked"

  • "LiveBallTurnoverPct"

  • "DefFTReboundPct"

  • "OffFTReboundPct"

  • "DefTwoPtReboundPct"

  • "OffTwoPtReboundPct"

  • "DefThreePtReboundPct"

  • "OffThreePtReboundPct"

  • "DefFGReboundPct"

  • "OffFGReboundPct"

  • "OffAtRimReboundPct"

  • "OffShortMidRangeReboundPct"

  • "OffLongMidRangeReboundPct"

  • "OffArc3ReboundPct"

  • "OffCorner3ReboundPct"

  • "DefAtRimReboundPct"

  • "DefShortMidRangeReboundPct"

  • "DefLongMidRangeReboundPct"

  • "DefArc3ReboundPct"

  • "DefCorner3ReboundPct"

  • "BlocksRecoveredPct"

  • "SecondsPerPossOff"

  • "SecondsPerPossDef"

  • "AtRimFrequency"

  • "AtRimAccuracy"

  • "AtRimPctAssisted"

  • "ShortMidRangeFrequency"

  • "ShortMidRangeAccuracy"

  • "ShortMidRangePctAssisted"

  • "LongMidRangeFrequency"

  • "LongMidRangeAccuracy"

  • "LongMidRangePctAssisted"

  • "Corner3Frequency"

  • "Corner3Accuracy"

  • "Corner3PctAssisted"

  • "Arc3Frequency"

  • "Arc3Accuracy"

  • "Arc3PctAssisted"

  • "AtRimFG3AFrequency"

  • "NonHeaveArc3Accuracy"

  • "ShotQualityAvg"

  • "ShootingFoulsDrawnPct"

  • "TwoPtShootingFoulsDrawnPct"

  • "ThreePtShootingFoulsDrawnPct"

  • "SecondChancePointsPct"

  • "PenaltyPointsPct"

  • "PenaltyOffPossPct"

  • "Avg2ptShotDistance"

  • "Avg3ptShotDistance"

  • "PenaltyEfficiencyExcludingTakeFouls"

  • "DefReboundPct"

  • "OffReboundPct"

  • "PtsPer100Poss"

  • "AssistPointsPer100Poss"

  • "FTAPer100Poss"

  • "TurnoversPer100Poss"

  • "AssistsPer100Poss"

  • "PtsPer100PossOpponent"

  • "OpponentShotQualityAvg"

  • "Fg3PctOpponent"

  • "Fg2PctOpponent"

  • "EfgPctOpponent"

  • "FG3APctOpponent"

  • "AtRimFrequencyOpponent"

  • "AtRimAccuracyOpponent"

  • "ShortMidRangeFrequencyOpponent"

  • "ShortMidRangeAccuracyOpponent"

  • "LongMidRangeFrequencyOpponent"

  • "LongMidRangeAccuracyOpponent"

  • "Corner3FrequencyOpponent"

  • "Corner3AccuracyOpponent"

  • "Arc3FrequencyOpponent"

  • "Arc3AccuracyOpponent"

  • "Pace"

  • "SecondChancePtsPer100PossSecondChance"

  • "PenaltyPtsPer100PossPenalty"

  • "SecondChanceOffPossPer100Poss"

  • "FirstChancePtsPer100Poss"

  • "SecondChancePtsPer100Poss"

.

Value

A tibble of on/off metrics as returned by the API.

References

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