From 12188207d6a784035a82d98a9bfa80437668cb0e Mon Sep 17 00:00:00 2001 From: Sebastian Carl Date: Tue, 17 Sep 2024 15:55:37 +0200 Subject: [PATCH] Add new penalty type from dynamic kickoff rules --- DESCRIPTION | 2 +- R/helper_add_nflscrapr_mutations.R | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index a7f8c1d0..8dd20839 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: nflfastR Title: Functions to Efficiently Access NFL Play by Play Data -Version: 4.6.1.9016 +Version: 4.6.1.9017 Authors@R: c(person(given = "Sebastian", family = "Carl", diff --git a/R/helper_add_nflscrapr_mutations.R b/R/helper_add_nflscrapr_mutations.R index 0774ba2e..63dc5566 100644 --- a/R/helper_add_nflscrapr_mutations.R +++ b/R/helper_add_nflscrapr_mutations.R @@ -92,6 +92,12 @@ add_nflscrapr_mutations <- function(pbp) { stringr::str_remove("\\([0-9]{2}+ Yards\\)") %>% stringr::str_squish(), NA_character_ ), + # The new "dynamic Kickoff" in the 2024 season introduces a new penalty type + penalty_type = dplyr::if_else( + .data$penalty == 1 & stringr::str_detect(tolower(.data$play_description), "kickoff short of landing zone"), + "Kickoff Short of Landing Zone", + .data$penalty_type + ), # Make plays marked with down == 0 as NA: down = dplyr::if_else( .data$down == 0,