Skip to content

Commit

Permalink
Push nflfastR 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Jul 29, 2020
1 parent 8bef6fa commit 1f15706
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 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 Scrape NFL Play by Play Data
Version: 2.1.2
Version: 2.1.3
Authors@R:
c(person(given = "Sebastian",
family = "Carl",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# nflfastR 2.1.3

* Fixed a bug in `series_success` caused by bad `drive` information provided by NFL

# nflfastR 2.1.2

* Added the following columns that are available 2011 and later: `special_teams_play`, `st_play_type`, `time_of_day`, and `order_sequence`
Expand Down
17 changes: 12 additions & 5 deletions R/helper_add_series_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,18 @@ add_series_data <- function(pbp) {
first_down = dplyr::if_else(
#earn first down
(.data$first_down_rush == 1 | .data$first_down_pass == 1 | .data$first_down_penalty == 1 |
#defensive TD
(.data$touchdown == 1 & .data$td_team != .data$posteam) |
#drive changes
(.data$drive < dplyr::lead(.data$drive) | (.data$drive < dplyr::lead(.data$drive, 2) & is.na(dplyr::lead(.data$drive))))
) &
#defensive TD
(.data$touchdown == 1 & .data$td_team != .data$posteam) |
# posteam changes
(
#change in posteam
.data$posteam != dplyr::lead(.data$posteam) |
#change in posteam in t+2 and na posteam in t+1
(.data$posteam != dplyr::lead(.data$posteam, 2) & is.na(dplyr::lead(.data$posteam))) |
#change in posteam in t+3 and na posteam in t+1 and t+2
(.data$posteam != dplyr::lead(.data$posteam, 3) & is.na(dplyr::lead(.data$posteam, 2)) & is.na(dplyr::lead(.data$posteam)))
)
) &
(.data$extra_point_attempt == 0 & .data$two_point_attempt == 0 & .data$kickoff_attempt == 0),
1, 0
),
Expand Down
8 changes: 4 additions & 4 deletions R/helper_additional_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#' \item{first_down}{Binary indicator if the play ended in a first down.}
#' \item{aborted_play}{Binary indicator if the play description indicates "Aborted".}
#' \item{play}{Binary indicator: 1 if the play was a 'normal' play (including penalties), 0 otherwise.}
#' \item{passer_id}{ID of the player in the 'passer' column (NOTE: ids vary pre and post 2011)}
#' \item{rusher_id}{ID of the player in the 'rusher' column (NOTE: ids vary pre and post 2011)}
#' \item{receiver_id}{ID of the player in the 'receiver' column (NOTE: ids vary pre and post 2011)}
#' \item{passer_id}{ID of the player in the 'passer' column (NOTE: ids vary pre and post 2011 but are consistent for each player. Please see details for further information)}
#' \item{rusher_id}{ID of the player in the 'rusher' column (NOTE: ids vary pre and post 2011 but are consistent for each player. Please see details for further information)}
#' \item{receiver_id}{ID of the player in the 'receiver' column (NOTE: ids vary pre and post 2011 but are consistent for each player. Please see details for further information)}
#' \item{name}{Name of the 'passer' if it is not 'NA', or name of the 'rusher' otherwise.}
#' \item{id}{ID of the player in the 'name' column.}
#' \item{id}{ID of the player in the 'name' column (NOTE: ids vary pre and post 2011 but are consistent for each player. Please see details for further information)}
#' \item{qb_epa}{Gives QB credit for EPA for up to the point where a receiver lost a fumble after a completed catch and makes EPA work more like passing yards on plays with fumbles.}
#' }
#' @export
Expand Down
8 changes: 4 additions & 4 deletions man/clean_pbp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/teams_colors_logos.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed nflfastR_2.1.2.pdf
Binary file not shown.

0 comments on commit 1f15706

Please sign in to comment.