Calculate player on-ice stats
calculate_on_ice(pbp, type = c("R", "P"), game_strength = "all")
A tibble of play-by-play data, typically returned from either
load_pbp
or scrape_game
Season type to filter by; "R" for regular season and/or "P" for postseason
String or vector of strings defining strength state to filter by; ex c("3v5","4v5","3v4") returns stats for shorthanded strength
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:
String identifying player name
Integer value of the NHL player ID
String identifying player's most recent team
Games Played
Numeric shot attempts (Corsi) for
Numeric shot attempts (Corsi) against
Numeric Corsi For % (CF%)
Numeric unblocked shot attempts (Fenwick) for
Numeric unblocked shot attempts (Fenwick) against
Numeric Fenwick For % (FF%)
Numeric goals for
Numeric goals against
Numeric Goals For % (GF%)
Numeric expected goals for
Numeric expected goals against
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:
String description of total time on ice in 'minutes:seconds'
String description of average time on ice over all supplied games, in 'minutes:seconds'
Numeric total time on ice, in minutes
Numeric average time on ice over all supplied games, in minutes
Numeric shot attempts (Corsi) for per 60 minutes
Numeric shot attempts (Corsi) against per 60 minutes
Numeric unblocked shot attempts (Fenwick) for per 60 minutes
Numeric unblocked shot attempts (Fenwick) against per 60 minutes
Numeric goals for per 60 minutes
Numeric goals against per 60 minutes
Numeric expected goals for per 60 minutes
Numeric expected goals against per 60 minutes
if (FALSE) {
#load pbp
pbp_2022 <- load_pbp(2022, shift_events = TRUE)
player_stats <- calculate_on_ice(pbp_2022, type = "R", game_strength = "5v5")
}