File tree 4 files changed +21
-1
lines changed
4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
Type: Package
2
2
Package: nflfastR
3
3
Title: Functions to Efficiently Access NFL Play by Play Data
4
- Version: 5.0.0.9000
4
+ Version: 5.0.0.9001
5
5
Authors@R:
6
6
c(person(given = "Sebastian",
7
7
family = "Carl",
Original file line number Diff line number Diff line change 1
1
# nflfastR (development version)
2
2
3
3
- Fixed a bug where ` calculate_stats() ` incorrectly counted ` receiving_air_yards ` . (#500 )
4
+ - Fixed a bug where ` vegas_wp ` variables were broken when ` spread_line ` data was missing. (#503 )
4
5
5
6
# nflfastR 5.0.0
6
7
Original file line number Diff line number Diff line change @@ -196,6 +196,24 @@ wp_spread_model_select <- function(pbp) {
196
196
}
197
197
prepare_wp_data <- function (pbp ) {
198
198
199
+ if (any(is.na(pbp $ spread_line ))){
200
+ broken_games <- pbp %> %
201
+ dplyr :: filter(is.na(.data $ spread_line )) %> %
202
+ dplyr :: pull(game_id ) %> %
203
+ unique() %> %
204
+ sort()
205
+ cli :: cli_alert_danger(
206
+ " The following game{?s} {?is/are} missing valid spread lines: {.val {broken_games}}."
207
+ )
208
+ cli :: cli_alert_warning(
209
+ " nflfastR will manually set the spread for the home team to {.val 1.5} points!"
210
+ )
211
+ cli :: cli_alert_warning(
212
+ " If you see this, please reach out to the package maintainers {.url https://github.com/nflverse/nflfastR/issues}"
213
+ )
214
+ pbp $ spread_line [is.na(pbp $ spread_line )] <- 1.5
215
+ }
216
+
199
217
pbp <- pbp %> %
200
218
dplyr :: group_by(.data $ game_id ) %> %
201
219
dplyr :: mutate(
Original file line number Diff line number Diff line change 1
1
Version: 1.0
2
+ ProjectId: e1e14382-386c-49b3-9b3f-206a4cc98503
2
3
3
4
RestoreWorkspace: Default
4
5
SaveWorkspace: Default
You can’t perform that action at this time.
0 commit comments