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

Missing MFL IDs (name-cleaning issue?) #153

Open
TheMathNinja opened this issue Aug 26, 2024 · 0 comments
Open

Missing MFL IDs (name-cleaning issue?) #153

TheMathNinja opened this issue Aug 26, 2024 · 0 comments

Comments

@TheMathNinja
Copy link

TheMathNinja commented Aug 26, 2024

Hi, I'm running this code because I want to work on joins by MFL ID using this package:

#Create df of all ffanalytics source site names
ffa_full_scrape <- ffanalytics::scrape_data(
  src = c("CBS", "ESPN", "FantasyPros", "FantasySharks", "FFToday", "NumberFire",
          "FantasyFootballNerd", "NFL", "RTSports", "Walterfootball"),
  pos = c("QB", "RB", "WR", "TE", "K", "DST", "DL", "LB", "DB"),
  season = 2024,
  week = 0
)

#Convert to readable dataframes by position
#WARNING: do not run the following df conversions unless the above scrape ran error-free (otherwise it will make empty df's)
ffaQB_scrape <- as.data.frame(ffa_full_scrape[1]) %>%
  rename_all(~stringr::str_replace(.,"^QB.",""))
ffaRB_scrape <- as.data.frame(ffa_full_scrape[2]) %>%
  rename_all(~stringr::str_replace(.,"^RB.",""))
ffaWR_scrape <- as.data.frame(ffa_full_scrape[3]) %>%
  rename_all(~stringr::str_replace(.,"^WR.",""))
ffaTE_scrape <- as.data.frame(ffa_full_scrape[4]) %>%
  rename_all(~stringr::str_replace(.,"^TE.",""))
ffaPK_scrape <- as.data.frame(ffa_full_scrape[5]) %>%
  rename_all(~stringr::str_replace(.,"^K.",""))
ffaDST_scrape <- as.data.frame(ffa_full_scrape[6]) %>%
  rename_all(~stringr::str_replace(.,"^DST.",""))
ffaDL_scrape <- as.data.frame(ffa_full_scrape[7]) %>%
  rename_all(~stringr::str_replace(.,"^DL.",""))
ffaLB_scrape <- as.data.frame(ffa_full_scrape[8]) %>%
  rename_all(~stringr::str_replace(.,"^LB.",""))
ffaDB_scrape <- as.data.frame(ffa_full_scrape[9]) %>%
  rename_all(~stringr::str_replace(.,"^DB.",""))

ffa_names_database <- bind_rows(ffaQB_scrape,
                                ffaRB_scrape,
                                ffaWR_scrape,
                                ffaTE_scrape,
                                ffaPK_scrape,
                                ffaDST_scrape,
                                ffaDL_scrape,
                                ffaLB_scrape,
                                ffaDB_scrape) %>%
  rename(mfl_id = id) %>%
  filter(is.na(mfl_id))

This shows curious omissions (like Chig Okonkwo and Josh Palmer missing MFL ID's at times). I'm guessing in the Okonkwo/Palmer case it's a name-cleaning issue where they aren't joining somewhere because of alternates to their name?

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
@TheMathNinja and others