Open TheMathNinja opened 2 years ago
This is actually not a bug in return yards as it is exactly the same like for rushing or receiving yards when laterals happen in a play. We could catch this for plays with one lateral (!) by adding a lateral_return_yards variable for stat IDs 27 and 28
Here https://github.com/nflverse/nflfastR/blob/0fa754dda504b133e03885f6ef53bf8e21a56276/R/helper_tidy_play_stats.R#L189 and here https://github.com/nflverse/nflfastR/blob/0fa754dda504b133e03885f6ef53bf8e21a56276/R/helper_tidy_play_stats.R#L201
Analog to stat IDs 23 and 24 for example https://github.com/nflverse/nflfastR/blob/0fa754dda504b133e03885f6ef53bf8e21a56276/R/helper_tidy_play_stats.R#L149 https://github.com/nflverse/nflfastR/blob/0fa754dda504b133e03885f6ef53bf8e21a56276/R/helper_tidy_play_stats.R#L163
As soon as multiple laterals with non 0 yards happen in a play there is no chance to see them in either of these variables. That would be very inefficient in a tidy data structure.
For calculate_player_stats()
we catch this by loading yards from a separate file that is hosting plays with multiple laterals, which are very rare but happen.
Have you installed the latest development version of the package(s) in question? Yes
Describe the bug
return_yards
is returning the wrong number in the pbp df.Reprex
Expected Behaviour
return_yards
should be 6. Anthony Harris should get 2, then he laterals to Darius Slay who gets 4 more. Butreturn_yards
shows 4, only counting the yards post-lateral.nflverse_sitrep()
sitrep
```r # nflverse_sitrep() goes here ```Screenshots
Additional context