Using this line of code, I can retrieve ~55 columns of details for each of the 15 games played at the AAA level in professional baseball last Friday, the 31st. Package used here is baseballr.
One of the columns of data generated is game_pk which is the unique identifier of the specific game and in the code above, 15 such unique numbers are returned.
My question is how to pass through each of the 15 unique game_pk numbers through this line of code to then pull all of the pitch by pitch data?
Note there may very well be another function in baseballr that will do this automatically by just plugging in the desired date range but I am actually trying to learn a little about looping in R using data I am familiar with.
You need to store the output in a list or otherwise accumulate the results rather than overwrite the value as your example does.
I hope this works but I wouldn't be surprised if it needs adjustment.