From 2ea4c887836759f3889c66a302bb4c98b9393007 Mon Sep 17 00:00:00 2001 From: Ben Baldwin <1425357+guga31bb@users.noreply.github.com> Date: Mon, 6 May 2024 13:51:51 -0400 Subject: [PATCH 1/2] score fix 2022 --- DESCRIPTION | 2 +- NEWS.md | 1 + R/helper_scrape_nfl.R | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0e6fb46b..d648ebb9 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.9008 +Version: 4.6.1.9009 Authors@R: c(person(given = "Sebastian", family = "Carl", diff --git a/NEWS.md b/NEWS.md index 790523df..e29cb747 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ - Fixed a problem where the `goal_to_go` variable was `FALSE` in actual goal to go situations. (#460) - Fixed a bug in `fixed_drive` and `fixed_drive_result` where the second weather delay in `2023_13_ARI_PIT` wasn't identified correctly. (#461) - `punter_player_id`, and `punter_player_name` are filled for blocked punt attempts. (#463) +- Fixed an issue affecting scores of 2022 games involving a return touchdown (#466) # nflfastR 4.6.1 diff --git a/R/helper_scrape_nfl.R b/R/helper_scrape_nfl.R index a9bec2ba..79ff4576 100644 --- a/R/helper_scrape_nfl.R +++ b/R/helper_scrape_nfl.R @@ -12,7 +12,7 @@ get_pbp_nfl <- function(id, ...) { #testing - #id = '2019_01_GB_CHI' + #id = '2022_01_PHI_DET' # id = '2015_01_CAR_JAX' #id = '2011_01_NO_GB' @@ -384,7 +384,7 @@ fix_posteams <- function(pbp){ # # We adjust both things here, but only for 2023ff to avoid backwards compatibility problems # We need the variable pre_play_by_play which usually looks like "KC 1-10 NYJ 40" - if (any(pbp$season >= 2023) && ("pre_play_by_play" %in% names(pbp))){ + if (any(pbp$season >= 2022) && ("pre_play_by_play" %in% names(pbp))){ # Let's be as explicit as possible about what we want to extract from the string # It's really only the first valid team abbreviation followed by a blank space valid_team_abbrs <- paste(nflfastR::teams_colors_logos$team_abbr, collapse = " |") From fafce1234a6f1ea1b1ba9cd9082c373ed93900ce Mon Sep 17 00:00:00 2001 From: Ben Baldwin <1425357+guga31bb@users.noreply.github.com> Date: Mon, 6 May 2024 14:41:39 -0400 Subject: [PATCH 2/2] remove season restriction --- R/helper_scrape_nfl.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/helper_scrape_nfl.R b/R/helper_scrape_nfl.R index 79ff4576..943911ee 100644 --- a/R/helper_scrape_nfl.R +++ b/R/helper_scrape_nfl.R @@ -384,7 +384,7 @@ fix_posteams <- function(pbp){ # # We adjust both things here, but only for 2023ff to avoid backwards compatibility problems # We need the variable pre_play_by_play which usually looks like "KC 1-10 NYJ 40" - if (any(pbp$season >= 2022) && ("pre_play_by_play" %in% names(pbp))){ + if ("pre_play_by_play" %in% names(pbp)){ # Let's be as explicit as possible about what we want to extract from the string # It's really only the first valid team abbreviation followed by a blank space valid_team_abbrs <- paste(nflfastR::teams_colors_logos$team_abbr, collapse = " |")