Function: scoring_chances()
scoring_chances(
pbp,threshold_ft?):Row[]
Defined in: src/analytics/hockeytech.ts:588
Add scoring_chance = shot-type event within threshold_ft of the net (false for non-shots).
Parameters
pbp
Row[]
Play-by-play rows. If the first row has no shot_distance column,
add_shot_distance_angle is run first with its default goal_x.
threshold_ft?
number = SCORING_CHANCE_FT
Maximum shot_distance (feet, inclusive) that counts as a chance.
Default 25.
Returns
Row[]
A new array of copied rows with boolean scoring_chance: true when
shot_distance is non-null and <= threshold_ft, else false (never null).
Example
import { add_shot_distance_angle, scoring_chances } from "sportsdataverse/dist/analytics/hockeytech.js";
const rows = scoring_chances(add_shot_distance_angle(rinkFeetPbp, 80), 15);
rows.filter((r) => r.scoring_chance).length;
Remarks
Pass a custom goal_x by calling add_shot_distance_angle yourself first;
the implicit call here always uses the NHL-size default.