Skip to content

Commit

Permalink
Add new penalty type from dynamic kickoff rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Sep 17, 2024
1 parent e8e4219 commit 1218820
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 6 additions & 0 deletions R/helper_add_nflscrapr_mutations.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1218820

Please sign in to comment.