Calculate player on-ice stats

calculate_on_ice(pbp, type = c("R", "P"), game_strength = "all")

Arguments

pbp

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

type

Season type to filter by; "R" for regular season and/or "P" for postseason

game_strength

String or vector of strings defining strength state to filter by; ex c("3v5","4v5","3v4") returns stats for shorthanded strength

Value

A tibble containing on-ice shot stats for all players in supplied pbp data. These stats are for all players in which a player was on the ice, not individual stats.

For help with individual stats, please see calculate_individual. On-ice stats include:

player_name

String identifying player name

player_id

Integer value of the NHL player ID

team

String identifying player's most recent team

gp

Games Played

cf

Numeric shot attempts (Corsi) for

ca

Numeric shot attempts (Corsi) against

cf_perc

Numeric Corsi For % (CF%)

ff

Numeric unblocked shot attempts (Fenwick) for

fa

Numeric unblocked shot attempts (Fenwick) against

ff_perc

Numeric Fenwick For % (FF%)

gf

Numeric goals for

ga

Numeric goals against

gf_perc

Numeric Goals For % (GF%)

xgf

Numeric expected goals for

xga

Numeric expected goals against

xgf_perc

Numeric Expected Goals For % (xGF%)

If supplied play-by-play data includes shift change events (the default for scrape_game; if using load_pbp user must set shift_events argument to TRUE) then the following rate stats will also be calculated:

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

cf_per60

Numeric shot attempts (Corsi) for per 60 minutes

ca_per60

Numeric shot attempts (Corsi) against per 60 minutes

ff_per60

Numeric unblocked shot attempts (Fenwick) for per 60 minutes

fa_per60

Numeric unblocked shot attempts (Fenwick) against per 60 minutes

gf_per60

Numeric goals for per 60 minutes

ga_per60

Numeric goals against per 60 minutes

xgf_per60

Numeric expected goals for per 60 minutes

xga_per60

Numeric expected goals against per 60 minutes

Examples

if (FALSE) {
#load pbp
pbp_2022 <- load_pbp(2022, shift_events = TRUE)
player_stats <- calculate_on_ice(pbp_2022, type = "R", game_strength = "5v5")
}