calculate_angle: Calculate the Euclidean angle from the attacking net for all...

View source: R/Clean.R

calculate_angleR Documentation

Calculate the Euclidean angle from the attacking net for all the events (plays) in a play-by-play

Description

calculate_angle() calculates the Euclidean angle from the attacking net for all the events (plays) in a play-by-play.

Usage

calculate_angle(play_by_play)

Arguments

play_by_play

data.frame of play-by-play(s); see gc_play_by_play() and/or wsc_play_by_play() for reference; must be untouched by non-nhlscraper functions; saves time if normalize_coordinates() has already been called

Value

data.frame with one row per event (play) and added angle column

Examples

# May take >5s, so skip.

  test                   <- gc_play_by_play()
  test_is_home_flagged   <- flag_is_home(test)
  test_coords_normalized <- normalize_coordinates(test_is_home_flagged)
  test_angle_calculated  <- calculate_angle(test_coords_normalized)


nhlscraper documentation built on Dec. 17, 2025, 5:10 p.m.