sportsdataverse / fastRhockey

Boxscore and play-by-play stat scraper for the Premier Hockey Federation (PHF, formerly known as the NWHL).
https://fastRhockey.sportsdataverse.org
Other
21 stars 3 forks source link

nhl_game_feed() Pass a List of Game ID's to Load into One Dataframe #20

Open ghost opened 2 years ago

ghost commented 2 years ago

I would like to load all plays from all games in a particular season from a single particular team (e.g. all plays from the Flyers 2021-2022 season).

Currently nhl_game_feed() only accepts a single game ID and loads a list of data frames (all plays, penalty plays, player box...etc.)

Is there a way to pass a list of game ID's and arguments specifying which data frames to load (i.e. just all plays or just penalty plays)?

Looping through a list of game ID's and calling nhl_game_feed() takes a lot of resources both from the loop and also loading extra data frames I am not interested in. Any way around this?

I also thought I could use load_nhl_pbp() and filter based on home or away team. Is there a way to get this information from the fields in the play by play data?

saiemgilani commented 2 years ago

Is there a way to pass a list of game ID's ..

Will not do this. There are a number of packages and functions which will allow you to iterate over a list with ease, purrr and furrr come to mind, or even a simple lapply will do.

..and arguments specifying which data frames to load (i.e. just all plays or just penalty plays)?

This... feels like a good idea that should be doable. No guarantees on immediate implementation.

I also thought I could use load_nhl_pbp() and filter based on home or away team. Is there a way to get this information from the fields in the play by play data?

Wow. My freaking bad. I am only now realizing the play by play does not include a lot of identifying information. Will work on that.