Learn R Programming

nhlscraper (version 0.4.2)

normalize_coordinates: Normalize the x and y coordinates for all the events (plays) in a play-by-play

Description

normalize_coordinates() normalizes the x and y coordinates for all the events (plays) in a play-by-play such that they all attack towards +x. If homeTeamDefendingSide is not available, the home defending side in period 1 is inferred using zoneCode, isHome, and xCoord.

Usage

normalize_coordinates(play_by_play)

Value

data.frame with one row per event (play) and added columns xCoordNorm and yCoordNorm

Arguments

play_by_play

data.frame of play-by-play(s); see gc_play_by_play() and/or wsc_play_by_play() for reference