Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue parsing request for data involving "7+ Dribbles" dribble range #115

Open
shkoeneman opened this issue Mar 2, 2023 · 0 comments
Open

Comments

@shkoeneman
Copy link

shkoeneman commented Mar 2, 2023

I have been using nbastatR to aggregate some date related to player pull-up shooting. I first tried to pull the data with teams_players_stats using the following code:

shots_table <- teams_players_stats(seasons = 2019, types = "player", tables = "shots", modes = "Totals",
                                     dribble_ranges = c("1 Dribble","2 Dribbles","3-6 Dribbles","7+ Dribbles"),
                                     general_ranges = "Pullups",
                                     assign_to_environment = FALSE)

However, shots_tables only had 3 rows with these pertaining to the first 3 dribble ranges, and the function could not find any data for the "7+ Dribbles" range. I went to stats.nba.com and investigated what could be the issue, and found that while nbastatsR forms the url for other dribble ranges correctly, it does not do so for the "7+ Dribbles" dribble range.

Example url for 3-6 Dribbles data: https://www.nba.com/stats/players/shots-dribbles?DribbleRange=3-6+Dribbles
Example url for 7+ Dribbles data: https://www.nba.com/stats/players/shots-dribbles?DribbleRange=7%2B+Dribbles

Looking through the code for the package, it seems the package does correctly parse the space into a "+" to form the url, as "3-6 Dribbles" converts correctly to "3-6+Dribbles" in the url. However, "7+ Dribbles" does not parse correctly in the package, parsing to form a url segment as "7++Dribbles" instead of "7%2B+Dribbles".

I can edit my function call to be:

shots_table <- teams_players_stats(seasons = 2019, types = "player", tables = "shots", modes = "Totals",
                                     dribble_ranges = c("1 Dribble","2 Dribbles","3-6 Dribbles","7%2B Dribbles"),
                                     general_ranges = "Pullups",
                                     assign_to_environment = FALSE)

This results in shots_tables pulling the data for all the desired ranges. But since this is cumbersome and unintuitive for a user to input, I'd suggest changing how "7+ Dribbles" is parsed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant