Description Usage Arguments Details Value
View source: R/helper_pbp_penalty_detection.R
Penalty Detection Adds penalty columns to Play-by-Play data pulled from the API
1 | penalty_detection(raw_df)
|
raw_df |
(data.frame required): Performs data cleansing on Play-by-Play DataFrame, as pulled from 'cfb_pbp_data()' |
Runs penalty detection on the play text and play types. Requires the following columns be present:
game_id
period
down
play_type
play_text
The original 'raw_df' with the following columns appended/redefined:
TRUE/FALSE flag for penalty play types or penalty in play text plays.
TRUE/FALSE flag for 'declined' in penalty play types or penalty in play text plays.
TRUE/FALSE flag for 'no play' in penalty play types or penalty in play text plays.
TRUE/FALSE flag for 'off-setting' in penalty play types or penalty in play text plays.
TRUE/FALSE flag for 1st Down in penalty play types or penalty in play text plays.
TRUE/FALSE flag for penalty in text but not a penalty play type.
Copy of original play_type label prior to any changes by the proceeding functions
Defines kickoff downs and penalties on kickoffs and converts them from 5 (as from the API) to 1.
Defines 'play_type', "Penalty (Kickoff)", penalties on kickoffs with a repeat kick.
Defines the half variable (1, 2).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.