Skip to content

Commit

Permalink
Fix broken goal to go variable (#460)
Browse files Browse the repository at this point in the history
* Fix broken goal to go variable

* News bullet and version bump
  • Loading branch information
mrcaseb committed Mar 6, 2024
1 parent 623b4c6 commit 27ed061
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: nflfastR
Title: Functions to Efficiently Access NFL Play by Play Data
Version: 4.6.1.9005
Version: 4.6.1.9006
Authors@R:
c(person(given = "Sebastian",
family = "Carl",
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Expand Up @@ -7,6 +7,7 @@
- Fixed rare cases where the value of the `yrdln` variable didn't equal `"MID 50"` at midfield. (#459)
- Fixed rare cases where `drive_start_yard_line` missed the blank space between team name and yard line number. (#459)
- Fixed play description in some 1999 and 2000 games where the string "D.Holland" replaced the kick distance. (#459)
- Fixed a problem where the `goal_to_go` variable was `FALSE` in actual goal to go situations. (#460)

# nflfastR 4.6.1

Expand Down
5 changes: 4 additions & 1 deletion R/helper_scrape_nfl.R
Expand Up @@ -281,7 +281,10 @@ get_pbp_nfl <- function(id,
safety_team = ifelse(
.data$safety == 1 & .data$season <= 2015 & (.data$home_team %in% c("JAC", "JAX") | .data$away_team %in% c("JAC", "JAX")),
ifelse(.data$posteam == .data$home_team, .data$away_team, .data$home_team), .data$safety_team
)
),

# can't trust the goal_to_go variable so we overwrite it here
goal_to_go = as.integer(stringr::str_detect(tolower(.data$pre_play_by_play), "goal"))

) %>%
dplyr::mutate_if(
Expand Down

0 comments on commit 27ed061

Please sign in to comment.