A function to calculate individual skater time on ice for a provided play-by-play data set

calculate_toi(pbp)

Arguments

pbp

A tibble of play-by-play data, typically returned from either load_pbp or scrape_game

Value

A tibble containing time on ice information for every skater in supplied pbp data

player_name

String identifying player name

player_id

Integer value of the NHL player ID

gp

Games Played

toi

String description of total time on ice in 'minutes:seconds'

mean_toi

String description of average time on ice over all supplied games, in 'minutes:seconds'

toi_minutes

Numeric total time on ice, in minutes

mean_toi_minutes

Numeric average time on ice over all supplied games, in minutes

Examples

if (FALSE) {
pbp_2022 <- load_pbp(2022)
skater_toi <- calculate_toi(pbp_2022)
}