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

calculate_player_stats_def() fails if certain stats are missing in pbp #382

Closed
mrcaseb opened this issue Sep 21, 2022 · 0 comments · Fixed by #383
Closed

calculate_player_stats_def() fails if certain stats are missing in pbp #382

mrcaseb opened this issue Sep 21, 2022 · 0 comments · Fixed by #383

Comments

@mrcaseb
Copy link
Member

mrcaseb commented Sep 21, 2022

pbp <- nflfastR::build_nflfastR_pbp("2022_01_BUF_LA")
#> ── DONE 

nflfastR::calculate_player_stats_def(pbp)
#> Error in `pivot_longer_spec()`:
#> ! Can't combine `fumbled_1_player_id` <logical> and `fumbled_2_player_id` <character>.

#> Backtrace:
#>      ▆
#>   1. ├─nflfastR::calculate_player_stats_def(pbp)
#>   2. │ └─... %>% dplyr::ungroup() at nflfastR/R/aggregate_game_stats_def.R:278:2
#>   3. ├─dplyr::ungroup(.)
#>   4. ├─dplyr::summarise(...)
#>   5. ├─dplyr::group_by(., .data$season, .data$week, .data$team, .data$player_id)
#>   6. ├─dplyr::rename(., fumble = "fumbled", fumble_recovery_own = "fumble_recovery")
#>   7. ├─dplyr::filter(., !is.na(.data$player_id))
#>   8. ├─tidyr::pivot_wider(...)
#>   9. ├─dplyr::mutate(...)
#>  10. ├─tidyr::pivot_longer(...)
#>  11. └─tidyr:::pivot_longer.data.frame(...)
#>  12.   └─tidyr::pivot_longer_spec(data, spec, names_repair = names_repair, values_drop_na = values_drop_na,
#>   values_ptypes = values_ptypes, values_transform = values_transform)
#>  13.     └─vctrs::vec_ptype_common(...)
#>  14.       └─vctrs (local) `<fn>`()
#>  15.         └─vctrs::vec_default_ptype2(...)
#>  16.           └─vctrs::stop_incompatible_type(...)
#>  17.             └─vctrs:::stop_incompatible(...)
#>  18.               └─vctrs:::stop_vctrs(...)
#>  19.                 └─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = vctrs_error_call(call))

Created on 2022-09-21 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant