nflverse / nflfastR

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

[BUG] Complete pass when no pass was thrown #456

Closed guga31bb closed 7 months ago

guga31bb commented 7 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?

Loading from nflreadr

Describe the bug

Why is complete_pass = 1 on these plays

Reprex

nflreadr::load_pbp(2022) |> 
    filter(complete_pass == 1, play_type_nfl == "PENALTY" | is.na(air_yards)) |> 
    select(game_id, desc)

  game_id        desc                                                                                                                                                        
  <chr>          <chr>          

1 2022_04_MIN_NO (2:01) (No Huddle, Shotgun) 8-K.Cousins pass middle to 18-J.Jefferson to NO 19 for 11 yards (23-M.Lattimore).                                               
2 2022_21_CIN_KC (10:29) (Shotgun) 15-P.Mahomes sacked at KC 26 for -8 yards (92-B.Hill). PENALTY on CIN-20-E.Apple, Defensive Holding, 5 yards, enforced at KC 34 - No Play.
3 2022_21_CIN_KC (:30) (Shotgun) 10-I.Pacheco left end to CIN 47 for 6 yards (30-J.Bates; 91-T.Hendrickson).

Expected Behavior

complete_pass should be 0 for the latter 2 plays and why is air_yards missing on the first play

nflverse_sitrep

> nflverse_sitrep()
── System Info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• R version 4.3.1 (2023-06-16 ucrt) • Running under: Windows 11 x64 (build 22621)
── Package Status ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   package  installed  cran        dev   behind
1   nfl4th 1.0.4.9000 1.0.4 1.0.4.9002      dev
2 nflfastR 4.6.0.9000 4.6.1 4.6.1.9001 cran;dev
3 nflplotR 1.2.0.9001 1.2.0 1.2.0.9010      dev
4 nflreadr   1.4.0.01 1.4.0   1.4.0.11      dev
5 nflseedR      1.2.0 1.2.0 1.2.0.9000      dev
── Package Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• No options set for above packages
── Package Dependencies ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• askpass     (1.1)     • jsonlite     (1.8.7)   • tibble      (3.2.1)    
• backports   (1.4.1)   • labeling     (0.4.2)   • tidyr       (1.3.0)    
• cachem      (1.0.8)   • lifecycle    (1.0.3)   • tidyselect  (1.2.0)    
• cli         (3.6.1)   • listenv      (0.9.0)   • timechange  (0.2.0)    
• colorspace  (2.1-0)   • lubridate    (1.9.2)   • utf8        (1.2.3)    
• cpp11       (0.4.5)   • magick       (2.7.4)   • vctrs       (0.6.3)    
• curl        (5.0.2)   • magrittr     (2.0.3)   • viridisLite (0.4.2)    
• data.table  (1.14.8)  • memoise      (2.0.1)   • withr       (2.5.0)    
• digest      (0.6.33)  • mime         (0.12)    • xgboost     (1.7.5.1)  
• dplyr       (1.1.2)   • munsell      (0.5.0)   • codetools   (0.2-19)   
• fansi       (1.0.4)   • openssl      (2.1.0)   • compiler    (4.3.1)    
• farver      (2.1.1)   • parallelly   (1.36.0)  • graphics    (4.3.1)    
• fastmap     (1.1.1)   • pillar       (1.9.0)   • grDevices   (4.3.1)    
• fastrmodels (1.0.2)   • pkgconfig    (2.0.3)   • grid        (4.3.1)    
• furrr       (0.3.1)   • progressr    (0.13.0)  • lattice     (0.21-8)   
• future      (1.33.0)  • proto        (1.0.0)   • MASS        (7.3-60)   
• generics    (0.1.3)   • purrr        (1.0.1)   • Matrix      (1.5-4.1)  
• ggpath      (1.0.1)   • R6           (2.5.1)   • methods     (4.3.1)    
• ggplot2     (3.4.2)   • rappdirs     (0.3.3)   • mgcv        (1.8-42)   
• globals     (0.16.2)  • RColorBrewer (1.1-3)   • nlme        (3.1-162)  
• glue        (1.6.2)   • Rcpp         (1.0.11)  • parallel    (4.3.1)    
• gsubfn      (0.7)     • rlang        (1.1.1)   • splines     (4.3.1)    
• gtable      (0.3.3)   • scales       (1.2.1)   • stats       (4.3.1)    
• hms         (1.1.3)   • snakecase    (0.11.0)  • tools       (4.3.1)    
• httr        (1.4.6)   • stringi      (1.7.12)  • utils       (4.3.1)    
• isoband     (0.2.7)   • stringr      (1.5.0)     
• janitor     (2.2.0)   • sys          (3.4.2)     
── Not Installed ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• nflverse ()

Screenshots

No response

Additional context

No response

mrcaseb commented 7 months ago

First play is correct. It's just missing air_yards in the stats grafik

mrcaseb commented 7 months ago

Second play lists passing stats grafik

mrcaseb commented 7 months ago

Third play also lists passing stats and even 14 YAC! grafik

guga31bb commented 7 months ago

Fixed with re-scrape