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

drive fix #195

Merged
merged 1 commit into from
Feb 20, 2021
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.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