fastRhockey icon indicating copy to clipboard operation
fastRhockey copied to clipboard

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

Open ghost opened this issue 3 years ago • 1 comments

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?

ghost avatar Feb 17 '22 03:02 ghost

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.

saiemgilani avatar Mar 24 '22 13:03 saiemgilani