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

created load_injuries #14

Merged
merged 4 commits into from
Aug 5, 2021
Merged

created load_injuries #14

merged 4 commits into from
Aug 5, 2021

Conversation

john-b-edwards
Copy link
Contributor

  • created function to load injury report data from nflfastr-roster, load_injuries
  • documented load_injuries
  • added tests for load_injuries

* created function to load injury report data from nflfastr-roster, `load_injuries`
* documented `load_injuries`
* added tests for `load_injuries`
@tanho63
Copy link
Member

tanho63 commented Aug 5, 2021

Whoa, thanks for the PR @john-b-edwards! Can you bump the DESCRIPTION version to v0.0.5, add the function to the pkgdown function listing, and (optionally) add yourself as a ctb? I'll run the tests now

@john-b-edwards
Copy link
Contributor Author

Sure thing!

@tanho63
Copy link
Member

tanho63 commented Aug 5, 2021

Leaving for Seb to skim tomorrow

@tanho63 tanho63 mentioned this pull request Aug 5, 2021
22 tasks
@mrcaseb
Copy link
Member

mrcaseb commented Aug 5, 2021

I think I'd prefer the download logic of load_player_stats() here where we download the combined qs file and filter out the relevant season instead of using map_dfr because binding the rows can be inefficient compared to downloading the combined file.

@mrcaseb
Copy link
Member

mrcaseb commented Aug 5, 2021

And we should add a variables vignette at some point.

@john-b-edwards
Copy link
Contributor Author

john-b-edwards commented Aug 5, 2021

It's more efficient in some cases but less efficient in others. For example, with just one season, the map_dfr logic runs 3-4x faster:

> microbenchmark(load_depth_charts_map_dfr(2020),
+                load_depth_charts_qs(2020))
Unit: milliseconds
                            expr      min       lq     mean   median       uq      max neval
 load_depth_charts_map_dfr(2020) 144.6880 150.3648 158.3617 153.5149 159.7043 269.7690   100
      load_depth_charts_qs(2020) 413.3846 434.7697 462.5940 449.0656 464.7591 607.2297   100

but above a certain number of seasons, downloading the combined qs becomes faster.

> microbenchmark(load_depth_charts_map_dfr(2010:2020),
+                load_depth_charts_qs(2010:2020))
Unit: milliseconds
                                 expr       min        lq      mean    median       uq       max neval
 load_depth_charts_map_dfr(2010:2020) 1667.4698 1733.1402 1832.0657 1774.8827 1854.064 3801.4386   100
      load_depth_charts_qs(2010:2020)  425.5798  467.1775  509.8121  487.0074  534.993  688.6993   100

Happy to convert to the qs logic but curious which use case will be more prevalent or if there's a way to grant us some flexibility with this.

@mrcaseb
Copy link
Member

mrcaseb commented Aug 5, 2021

Oh yeah I assumed depth charts don't make sense for this logic as the overall file is quite big compared to one season. But that's not necessarily true for injuries (which is the reason why I commented this in this PR)?

@tanho63
Copy link
Member

tanho63 commented Aug 5, 2021

I’d just weigh in for these that I’d probably estimate the odds of someone wanting all the seasons vs one season in specific. Injuries perhaps all, depth chart perhaps one or two seasons? 🤷‍♂️

@mrcaseb
Copy link
Member

mrcaseb commented Aug 5, 2021

I tend to do season level for depth charts and overall for injuries.

@john-b-edwards
Copy link
Contributor Author

🤦 this is what i get for trying to work on two PRs simultaneously at 1 AM. Sorry @mrcaseb for the confusion

@john-b-edwards
Copy link
Contributor Author

Total agreement here, I think what you suggested works great. I'll put them together and push in a bit

@tanho63
Copy link
Member

tanho63 commented Aug 5, 2021 via email

Removed the purrr::map_dfr logic to read the complete injuries file and filter to a given season(s)
@mrcaseb
Copy link
Member

mrcaseb commented Aug 5, 2021

Looks good to me. Ready to merge @tanho63?

@tanho63 tanho63 merged commit 80fc7de into nflverse:main Aug 5, 2021
@john-b-edwards john-b-edwards deleted the load-injuries branch August 5, 2021 18:20
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 this pull request may close these issues.

None yet

3 participants