Learn R Programming

hockeyR (version 1.3.0)

calculate_xg: Calculate hockeyR expected goals (xG)

Description

Uses the hockeyR expected goals model to calculate xG for any pbp data frame generated by hockeyR

Usage

calculate_xg(pbp)

Value

The original supplied play-by-play data with a column for expected goals appended

Arguments

pbp

A play-by-play data frame, previously returned by hockeyR::scrape_game

Examples

Run this code
if (FALSE) {
pbp <- load_pbp(2022) %>% dplyr::select(-xg)
pbp_preds <- calculate_xg(pbp)
}

Run the code above in your browser using DataLab