cut_plays: Trim plays based on events

Description Usage Arguments Value

View source: R/cleaning_functions.R

Description

Trim frames for a play and/or remove plays based on how quickly provided events happen in the play.

Usage

1
2
3
4
5
6
7
cut_plays(
  df,
  end_events = c("pass_forward", "qb_sack", "qb_strip_sack", "qb_spike", "tackle",
    "pass_shovel"),
  time_after_event = 0,
  throw_frame = 25
)

Arguments

df

A dataframe containing player tracking data with event, frame_id, and play with the latter uniquely identifying plays.

end_events

Events designated as play end events. Defaults are when a pass is thrown or QB's involvement ends in some other way (sack, strip sack, shovel pass, etc).

time_after_event

Number of frames to keep after the end_events (default: 0). Note that there are 10 frames in each second so providing 10 would keep one additional second after a pass was thrown when using the default end events.

throw_frame

If not NULL, for plays when one of the end_events happens before this frame, these plays will be removed from the returned df (default: 25, ie 1.5 seconds into the play). To not employ play dropping, provide throw_frame = NULL and all of the plays provided in original df will be returned.

Value

The original df with trimmed frames (and if throw_frame not NULL, the shorter plays removed).


guga31bb/ngscleanR documentation built on Dec. 20, 2021, 1:47 p.m.