Skip to contents

add_shift_times() adds SecondsElapsedInShift and SecondsElapsedInPeriodSinceLastShift columns for the on-ice goalies and skaters already present in a public play-by-play. It accepts either a single game play-by-play plus shift_chart() data or a season aggregate plus shift_charts() data.

Usage

add_shift_times(play_by_play, shift_chart)

Arguments

play_by_play

data.frame of play-by-play(s) using the current public schema returned by gc_play_by_play(), gc_play_by_plays(), wsc_play_by_play(), or wsc_play_by_plays()

shift_chart

data.frame returned by shift_chart() or shift_charts()

Value

data.frame with one row per event (play) and added or updated scalar on-ice shift timing columns

Examples

# \donttest{
  pbp <- gc_play_by_play(game = 2023030417)
  sc  <- shift_chart(game = 2023030417)
  pbp <- add_shift_times(pbp, sc)
# }