Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new penalty type from dynamic kickoff rules #486

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- nflfastR tried to fix bugs in the underlying pbp data of JAX home games prior to the 2016 season. An update of the raw pbp data resolved those bugs so nflfastR needs to remove the hard coded adjustments. This means that nflfastR <= v4.6.1 will return incorrect pbp data for all Jacksonville home games prior to the 2016 season! (#478)
- Fixed a problem where `clean_pbp()` returned `pass = 1` in actual rush plays in very rare cases. (#479)
- Removed extra lines for injury timeouts that were breaking `fixed_drive` (#482)
- The variable `penalty_type` now correctly lists the penalty "Kickoff Short of Landing Zone" introduced in the 2024 season. (#486)

# nflfastR 4.6.1

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
Loading