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

List of Player ID's #17

Open
jenn12138 opened this issue Feb 15, 2022 · 1 comment
Open

List of Player ID's #17

jenn12138 opened this issue Feb 15, 2022 · 1 comment

Comments

@jenn12138
Copy link

Hi! Is there a way to get a list of player ID's from a season or multiple seasons? (i.e. all player IDs) I would like to use get_athlete() to get player info for all athletes from a season. Thank you!

@jthomasmock
Copy link
Owner

Howdy @jenn12138 !

To get athletes from multiple seasons you may want to use get_depth_chart() on your team of interest. That will return the player_id for your specific team of interest. You could then use purrr to iterate across the player IDs to get all of their individual data.

something like:

library(tidyverse)
library(espnscrapeR)
pit_roster <- purrr::map_dfr(2016:2021, ~get_depth_chart(.x, "PIT"))

pit_player_ids <- pit_roster %>%
  distinct(athlete_id) %>%
  pull()

pit_athletes <- pit_player_ids %>%
  purrr::map_dfr(get_athlete)

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

No branches or pull requests

2 participants