sportsdataverse / hoopR

An R package to quickly obtain clean and tidy men's basketball play by play data.
http://hoopr.sportsdataverse.org/
Other
81 stars 18 forks source link

Incorrect/Mismatched Game IDs in NBA API functions #135

Open mattmattoni opened 10 months ago

mattmattoni commented 10 months ago

Awesome package. However, there is an issue that there is a mismatch between game IDs across functions.

For example, if I use the load_nba_team_box(2024) function, the 12/4/2023 game between the Pelicans and Kings has game ID 401607492. However, this Game ID is not a valid input to any other arguments using the NBA API. Additionally, it does not follow the NBA API Game ID format, and does not even have the correct number of digits. Any NBA API function will give the following error:

nba_boxscoreadvancedv2(401607492) Error in nba_boxscoreadvancedv2(401607492) : object 'df_list' not found

Is there an error in game ID acquisition? If not, is there a way to easily find Game IDs that match the NBA's API? Or, is there some way to convert between IDs?

saiemgilani commented 10 months ago

Yeah, the loading functions currently use ESPN game_ids and to find the NBA API's game_id's, use the nba_schedule() function, which uses the NBA API as its data source. See the getting started vignette if you're confused about which functions correspond to others. I suppose the load functions aren't perfectly clearly documented