ffverse / ffscrapr

R API Client for Fantasy Football League Platforms
https://ffscrapr.ffverse.com
Other
81 stars 22 forks source link

ff_scoringhistory() and return fumbles for Sleeper #281

Open draftydesert277 opened 3 years ago

draftydesert277 commented 3 years ago

Describe the bug Discovered when comparing aggregate ff_scoringhistory() results by team that ff_scoringhistory() appears to be ignoring return fumbles. This is a pretty obscure scoring thing that I think may be unique to Sleeper. See: https://support.sleeper.app/en/articles/4056849-why-did-my-player-lose-points-for-a-special-teams-fumble

Reprex Please provide a short, reproducible example of the code you are trying to run. For more on reprexes, check out https://reprex.tidyverse.org

 # Please include the code used for the connection object from `ff_connect()`

Expected behavior Return fumbles to hit ff_scoringhistory() same as any other fumble

Session information Please copy the output of sessionInfo() into the box below.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context For reference, check out nflfastR data for Eagles/Rams, 2020. Cooper Kupp fumbled on a punt return, and I can verify that ff_scoringhistory() is 2.0 pts higher for my league than his official score in the Sleeper app.

tanho63 commented 3 years ago

Hm! That’s interesting. Will try to see if nflfastr has return fumbles

tanho63 commented 3 years ago

Hmm, it seems like they don’t have it, unfortunately: https://www.nflfastr.com/reference/calculate_player_stats.html

I’ll see if I can raise an issue and/or help fix it over there first and then can revisit this issue

draftydesert277 commented 3 years ago

Good news - they do! I was actually able to pull the fumble I referenced specifically. Not sure how easy this is to incorporate into existing functionality but check this out:

lar_phi <- nflfastR::build_nflfastR_pbp(game_ids = "2020_02_LA_PHI")

lar_phi <- filter(lar_phi, fumbled_1_player_id == "00-0033908")

lar_phi_t <- transpose(lar_phi)

Also I admit this is a bit of a hunch as I wasn't able to easily verify this for other games.

draftydesert277 commented 3 years ago

Hmm, it seems like they don’t have it, unfortunately: https://www.nflfastr.com/reference/calculate_player_stats.html

I’ll see if I can raise an issue and/or help fix it over there first and then can revisit this issue

Oh! I see it's an issue with their stat aggregation. I assumed you were doing some wizardry with the raw pbp data.

I suppose I could work around this by creating a separate dataset of just kick/fumble returns based on build_nflfastR_pbp()?

tanho63 commented 3 years ago

Yup, that’s definitely a way to get around it for now, I suspect that the nflfastr team would be happy to take in requests for these sort of aggregations

tanho63 commented 3 years ago

Tacked on a request at nflverse/nflfastR#235, when that gets resolved I can re-map here.

tanho63 commented 1 year ago

Brief update as of 2022-12-11: still pending on fumble recovery/fumble returns being included in nflreadr::load_player_stats(), at the moment this is still unscheduled. Also tracked in: nflverse/nflfastR#336.