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

statcast_search_batters returns Error: Can't assign 94 names to a 112-column data.table #346

Closed
teajay opened this issue Jul 11, 2024 · 4 comments

Comments

@teajay
Copy link

teajay commented Jul 11, 2024

Describe the bug
About an hour ago statcast_search_batters started returning "Error: Can't assign 94 names to a 112-column data.table"

To Reproduce
Run this command
statcast_search_batters("2024-03-28", Sys.Date() - 1, 691026)

I don't recall all of the columns in the previous result set, but it looks like some extra columns on the right side of the CSV returned from the direct API call below. Columns starting after swing_length. i.e., from home_score onward
https://baseballsavant.mlb.com/statcast_search/csv?all=true&hfPT=&hfAB=&hfBBT=&hfPR=&hfZ=&stadium=&hfBBL=&hfNewZones=&hfGT=R%7CPO%7CS%7C&hfC&hfSea=2024%7C&hfSit=&hfOuts=&opponent=&pitcher_throws=&batter_stands=&hfSA=&player_type=batter&hfInfield=&team=&position=&hfOutfield=&hfRO=&home_road=&batters_lookup%5B%5D=691026&game_date_gt=2024-03-28&game_date_lt=2024-07-09&hfFlag=&hfPull=&metric_1=&hfInn=&min_pitches=0&min_results=0&group_by=name&sort_col=pitches&player_event_sort=h_launch_speed&sort_order=desc&min_abs=0&type=details

Version:
baseballr v1.6.0

@mlascaleia
Copy link

See #337

@teajay
Copy link
Author

teajay commented Jul 11, 2024

See #337

I’m familiar with that issue. Upgraded from the CRAN version to 1.6.0 hosted here on GitHub to resolve some time ago. It would appear there was another breaking change, of a similar nature. Are you not able to repro?

@mlascaleia
Copy link

I'd be very surprised if it's a different issue. If you read through that thread I mention that, as the package is currently coded, it will break in this way every single time the MLB adds a new column in statcast. So, a new column (or set of columns) must have been added and the package hasn't been updated to address it, thus making it so that updating the package won't fix the issue

@teajay
Copy link
Author

teajay commented Jul 11, 2024

Thank you for clarifying, I thought you were referring to the breaking change when MLB added the 2 bat swing fields a while ago. I hadn't seen your most recent comment this morning -- you are in fact talking about the issue of extra columns in general.

Thank you as well for a change to unblock things - I had just finished coding up my first Shiny app and was ready to publish last night just as things broke.

@teajay teajay closed this as completed Jul 11, 2024
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

2 participants