sportsdataverse / hoopR

An R package to quickly obtain clean and tidy men's basketball play by play data.
http://hoopr.sportsdataverse.org/
Other
81 stars 18 forks source link

joining data frames with different player ID conventions #101

Open bmacGTPM opened 1 year ago

bmacGTPM commented 1 year ago

It seems like some data frames use ESPN player IDs, and some have NBA player IDs. Is there a table in the package that has both IDs and helps with joining these data frames? Here is an example:

#### Player list has PERSON_ID ####

p = nba_commonallplayers(
  is_only_current_season = 0,
  league_id = "00")
p=p$CommonAllPlayers
p %>% 
  filter(DISPLAY_FIRST_LAST=='LeBron James') %>% 
  as.data.frame() ## PERSON_ID 2544, no other ID columns

#### Player bio info has PERSON_ID ####

dd = nba_commonplayerinfo(league='00',player_id = 2544)
dd$CommonPlayerInfo %>% as.data.frame() ## PERSON_ID 2544, no other ID columns

#### Player box score has athlete_id ####

pbox = load_nba_player_box()
pbox %>% 
  filter(athlete_display_name=='LeBron James') %>%
  head(1) %>% 
  as.data.frame() ## athlete_id 1966, no PERSON_ID or other ID columns
saiemgilani commented 1 year ago

It would be really nice. Not yet, is your answer. But in the coming months? Possibly

saiemgilani commented 1 year ago

Soon