Skip to contents

Get NBA Stats API play-by-play (Multiple Games)

Get NBA Stats API play-by-play (Multiple Games)

Usage

nba_pbps(
  game_ids = NULL,
  on_court = TRUE,
  version = "v2",
  nest_data = FALSE,
  ...
)

Arguments

game_ids

Game IDs

on_court

IF TRUE will be added ID of players on court

version

Play-by-play version ("v2" available from 2016-17 onwards)

nest_data

If TRUE returns nested data by game

...

Additional arguments passed to an underlying function like httr.

Value

Returns a data frame: PlayByPlay

col_nametypes
game_idcharacter
event_numcharacter
event_typecharacter
event_action_typecharacter
periodnumeric
minute_gamenumeric
time_remainingnumeric
wc_time_stringcharacter
time_quartercharacter
minute_remaining_quarternumeric
seconds_remaining_quarternumeric
home_descriptioncharacter
neutral_descriptioncharacter
visitor_descriptioncharacter
scorecharacter
away_scorenumeric
home_scorenumeric
score_margincharacter
person1typecharacter
player1_idcharacter
player1_namecharacter
player1_team_idcharacter
player1_team_citycharacter
player1_team_nicknamecharacter
player1_team_abbreviationcharacter
person2typecharacter
player2_idcharacter
player2_namecharacter
player2_team_idcharacter
player2_team_citycharacter
player2_team_nicknamecharacter
player2_team_abbreviationcharacter
person3typecharacter
player3_idcharacter
player3_namecharacter
player3_team_idcharacter
player3_team_citycharacter
player3_team_nicknamecharacter
player3_team_abbreviationcharacter
video_available_flagcharacter
team_leadingcharacter
away_player1numeric
away_player2numeric
away_player3numeric
away_player4numeric
away_player5numeric
home_player1numeric
home_player2numeric
home_player3numeric
home_player4numeric
home_player5numeric

Details

y <- c("0022201086", "0022200021")

nba_pbps(game_ids = y, version = "v2")

See also

Other NBA PBP Functions: nba_data_pbp(), nba_live_pbp(), nba_pbp(), nba_winprobabilitypbp()

Author

Jason Lee