nflverse / nflfastR

A Set of Functions to Efficiently Scrape NFL Play by Play Data
https://www.nflfastr.com/
Other
425 stars 52 forks source link

[BUG] dplyr deprecated functions when using calculate_player_stats_kicking() #480

Open isaactpetersen opened 2 months ago

isaactpetersen commented 2 months ago

Is there an existing issue for this?

Have you installed the latest development version of the package(s) in question?

If this is a data issue, have you tried clearing your nflverse cache?

I have cleared my nflverse cache and the issue persists.

What version of the package do you have?

4.6.1

Describe the bug

I receive the following warning when running the calculate_player_stats_kicking() function:

#> Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
#> dplyr 1.1.0.
#> ℹ Please use `reframe()` instead.
#> ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
#>   always returns an ungrouped data frame and adjust accordingly.
#> ℹ The deprecated feature was likely used in the nflfastR package.

Reprex

nfl_pbp <- progressr::with_progress(
  nflreadr::load_pbp(seasons = TRUE))

nfl_actualStats_kicking_weekly <- nflfastR::calculate_player_stats_kicking(
  nfl_pbp,
  weekly = TRUE)
#> Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
#> dplyr 1.1.0.
#> ℹ Please use `reframe()` instead.
#> ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
#>   always returns an ungrouped data frame and adjust accordingly.
#> ℹ The deprecated feature was likely used in the nflfastR package.
#>   Please report the issue at <https://github.com/nflverse/nflfastR/issues>.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

sessionInfo()
#> R version 4.3.1 (2023-06-16 ucrt)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 11 x64 (build 22631)
#> 
#> Matrix products: default
#> 
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.utf8 
#> [2] LC_CTYPE=English_United States.utf8   
#> [3] LC_MONETARY=English_United States.utf8
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.utf8    
#> 
#> time zone: America/Chicago
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] tidyr_1.3.1       utf8_1.2.4        future_1.34.0     generics_0.1.3   
#>  [5] fastrmodels_1.0.2 stringi_1.8.4     lattice_0.22-6    listenv_0.9.1    
#>  [9] digest_0.6.37     magrittr_2.0.3    evaluate_0.24.0   grid_4.3.1       
#> [13] timechange_0.3.0  fastmap_1.2.0     xgboost_1.7.8.1   jsonlite_1.8.8   
#> [17] Matrix_1.6-5      mgcv_1.9-1        purrr_1.0.2       fansi_1.0.6      
#> [21] codetools_0.2-20  cli_3.6.3         rlang_1.1.4       parallelly_1.38.0
#> [25] nflreadr_1.4.1    splines_4.3.1     reprex_2.1.1      withr_3.0.1      
#> [29] cachem_1.1.0      yaml_2.3.10       tools_4.3.1       parallel_4.3.1   
#> [33] memoise_2.0.1     dplyr_1.1.4       globals_0.16.3    nflfastR_4.6.1   
#> [37] curl_5.2.2        vctrs_0.6.5       R6_2.5.1          lifecycle_1.0.4  
#> [41] lubridate_1.9.3   stringr_1.5.1     snakecase_0.11.1  fs_1.6.4         
#> [45] furrr_0.3.1       janitor_2.2.0     pkgconfig_2.0.3   progressr_0.14.0 
#> [49] pillar_1.9.0      data.table_1.16.0 glue_1.7.0        xfun_0.47        
#> [53] tibble_3.2.1      tidyselect_1.2.1  rstudioapi_0.16.0 knitr_1.48       
#> [57] nlme_3.1-166      htmltools_0.5.8.1 rmarkdown_2.28    compiler_4.3.1

Created on 2024-09-04 with reprex v2.1.1

Expected Behavior

The expected behavior, as indicated, would be to use reframe() instead of summarise() to remove the warning.

nflverse_sitrep

> nflfastR::nflverse_sitrep()
── System Info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• R version 4.3.1 (2023-06-16 ucrt) • Running under: Windows 11 x64 (build 22631)
── Package Status ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   package installed  cran        dev behind
1   nfl4th     1.0.4 1.0.4 1.0.4.9002    dev
2 nflfastR     4.6.1 4.6.1 4.6.1.9013    dev
3 nflplotR     1.4.0 1.4.0      1.4.0       
4 nflreadr     1.4.1 1.4.1   1.4.1.02    dev
── Package Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• No options set for above packages
── Package Dependencies ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• askpass     (1.2.0)    • httr         (1.4.7)   • stringi     (1.8.4)       
• backports   (1.5.0)    • isoband      (0.2.7)   • stringr     (1.5.1)       
• base64enc   (0.1-3)    • janitor      (2.2.0)   • sys         (3.4.2)       
• bigD        (0.2.0)    • jquerylib    (0.1.4)   • tibble      (3.2.1)       
• bitops      (1.0-8)    • jsonlite     (1.8.8)   • tidyr       (1.3.1)       
• bslib       (0.8.0)    • juicyjuice   (0.1.0)   • tidyselect  (1.2.1)       
• cachem      (1.1.0)    • knitr        (1.48)    • timechange  (0.3.0)       
• cli         (3.6.3)    • labeling     (0.4.3)   • tinytex     (0.52)        
• colorspace  (2.1-1)    • lifecycle    (1.0.4)   • utf8        (1.2.4)       
• commonmark  (1.9.1)    • listenv      (0.9.1)   • V8          (5.0.0)       
• cpp11       (0.5.0)    • lubridate    (1.9.3)   • vctrs       (0.6.5)       
• curl        (5.2.2)    • magick       (2.8.4)   • viridisLite (0.4.2)       
• data.table  (1.16.0)   • magrittr     (2.0.3)   • withr       (3.0.1)       
• digest      (0.6.37)   • markdown     (1.13)    • xfun        (0.47)        
• dplyr       (1.1.4)    • Matrix       (1.6-5)   • xgboost     (1.7.8.1)     
• evaluate    (0.24.0)   • memoise      (2.0.1)   • xml2        (1.3.6)       
• fansi       (1.0.6)    • mime         (0.12)    • yaml        (2.3.10)      
• farver      (2.1.2)    • munsell      (0.5.1)   • codetools   (0.2-20)      
• fastmap     (1.2.0)    • openssl      (2.2.1)   • compiler    (4.3.1)       
• fastrmodels (1.0.2)    • parallelly   (1.38.0)  • graphics    (4.3.1)       
• fontawesome (0.5.2)    • pillar       (1.9.0)   • grDevices   (4.3.1)       
• fs          (1.6.4)    • pkgconfig    (2.0.3)   • grid        (4.3.1)       
• furrr       (0.3.1)    • progressr    (0.14.0)  • lattice     (0.22-6)      
• future      (1.34.0)   • purrr        (1.0.2)   • MASS        (7.3-60.0.1)  
• generics    (0.1.3)    • R6           (2.5.1)   • Matrix      (1.6-5)       
• ggpath      (1.0.2)    • rappdirs     (0.3.3)   • methods     (4.3.1)       
• ggplot2     (3.5.1)    • RColorBrewer (1.1-3)   • mgcv        (1.9-1)       
• globals     (0.16.3)   • Rcpp         (1.0.13)  • nlme        (3.1-166)     
• glue        (1.7.0)    • reactable    (0.4.4)   • parallel    (4.3.1)       
• gt          (0.11.0)   • reactR       (0.6.0)   • splines     (4.3.1)       
• gtable      (0.3.5)    • rlang        (1.1.4)   • stats       (4.3.1)       
• highr       (0.11)     • rmarkdown    (2.28)    • tools       (4.3.1)       
• hms         (1.1.3)    • sass         (0.4.9)   • utils       (4.3.1)       
• htmltools   (0.5.8.1)  • scales       (1.3.0)     
• htmlwidgets (1.6.4)    • snakecase    (0.11.1)    
── Not Installed ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• nflseedR ()
• nflverse ()
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Screenshots

No response

Additional context

No response

mrcaseb commented 3 weeks ago

We will deprecate calculate_player_stats_kicking() in a future release. The new function calculate_stats() (#470 ) will fix the issue