Skip to content

Commit

Permalink
Merge pull request #195 from mrcaseb/drive_fixes
Browse files Browse the repository at this point in the history
drive fix
  • Loading branch information
mrcaseb authored Feb 20, 2021
2 parents 4d5c54b + f4b674c commit 320370a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
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.0.0.9001
Version: 4.0.0.9002
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 @@ -3,6 +3,7 @@
* Added the function `calculate_player_stats()` that aggregates official passing, rushing, and receiving stats either at game level or overall
* Added the new columns `td_player_name` and `td_player_id` to clearly identify the player who scored a touchdown (this is especially helpful for plays with multiple fumbles or laterals resulting in a touchdown)
* Added the function `load_player_stats()` that loads weekly player stats from 1999 to the most recent season
* Fix bug in `drive` that was causing incorrect overtime win probabilities (#194)

# nflfastR 4.0.0

Expand Down
15 changes: 0 additions & 15 deletions R/helper_scrape_nfl.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,6 @@ get_pbp_nfl <- function(id, dir = NULL, qs = FALSE) {
.data$season <= 2015 & .data$yardline_side == 'JAX',
'JAC', .data$yardline_side
),
#if there's some random missing drive, fill in with previous drive
#this fixes a bug with plays appearing out of order after defensive TDs
drive = dplyr::if_else(
!is.na(dplyr::lag(.data$drive)) & !is.na(dplyr::lead(.data$drive)),
dplyr::lag(.data$drive), .data$drive
),
#fix for drives being messed up in this game
drive = dplyr::case_when(
id == '2012_04_NO_GB' & .data$play_id == 1085 ~ 4,
id == '2012_16_BUF_MIA' & .data$play_id == 2571 ~ 15,
id == '2015_16_CHI_TB' & .data$play_id == 2182 ~ 14,
id == '2019_12_IND_HOU' & .data$play_id == 2579 ~ 12,
id == '2019_12_IND_HOU' & .data$play_id == 2544 ~ 11,
TRUE ~ .data$drive
),
time = dplyr::case_when(
id == '2012_04_NO_GB' & .data$play_id == 1085 ~ '3:34',
id == '2012_16_BUF_MIA' & .data$play_id == 2571 ~ '8:31',
Expand Down

0 comments on commit 320370a

Please sign in to comment.