library(tidyverse)
theme_set(theme_light())
nhl_goals <- read_csv("https://raw.githubusercontent.com/36-SURE/2026/main/data/nhl-shots-2021.csv")
nhl_goals <- nhl_goals|>
mutate(is_goal = as.factor(case_when(shot_outcome == "GOAL" ~ 1,
TRUE ~ 0))) |>
dplyr::select(period, strength_code, shot_distance, shot_angle, is_goal) |>
filter(!is.na(shot_distance), !is.na(shot_angle), !is.na(strength_code))
glimpse(nhl_goals)Rows: 122,044
Columns: 5
$ period <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
$ strength_code <chr> "EV", "EV", "EV", "EV", "EV", "EV", "EV", "EV", "EV", "E…
$ shot_distance <dbl> 42.5, 30.6, 100.7, 29.3, 26.3, 42.0, 29.7, 39.8, 16.6, 2…
$ shot_angle <dbl> 48.8, 38.4, 15.6, 7.9, 8.7, 51.8, 19.7, 51.1, 32.7, 36.9…
$ is_goal <fct> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…









