add_on_ice_players: Add on-ice player IDs to a play-by-play by merging with shift charts
Description
add_on_ice_players() merges a play-by-play with a shift chart to determine which players are on the ice at each event. It adds home- and away-team on-ice player ID lists, as well as event-perspective for/against player ID lists when isHome is available.
Usage
add_on_ice_players(play_by_play, shift_chart)
Value
data.frame with one row per event (play) and added list-columns:
homePlayerIds, awayPlayerIds, playerIdsFor, and playerIdsAgainst
Arguments
play_by_play
data.frame of shift chart rows; see gc_play_by_play(), gc_play_by_plays(), wsc_play_by_play(), or wsc_play_by_plays() for reference; the original columns must exist
shift_chart
data.frame of shift chart rows; see shift_chart() or shift_charts() for reference; the original columns must exist