Created
September 15, 2020 14:25
-
-
Save tanho63/f3152f3526fc804b3796a8e7e7dbdc9c to your computer and use it in GitHub Desktop.
SFB week 1 matchups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ffscrapr) # on CRAN, woop woop! | |
| library(tidyverse) | |
| base_conn <- mfl_connect(2020, | |
| rate_limit_number = 2, | |
| rate_limit_seconds = 3) | |
| sfb_leagues <- mfl_getendpoint(base_conn, | |
| endpoint = "leagueSearch", | |
| SEARCH = "#SFBX Conference") %>% | |
| pluck("content","leagues","league") %>% | |
| tibble() %>% | |
| unnest_wider(1) %>% | |
| mutate(conn = map(id,~mfl_connect(2020, | |
| .x, | |
| rate_limit_number = 6, | |
| rate_limit_seconds = 10))) %>% | |
| mutate(matchups = map(conn, | |
| ~ff_schedule(.x) %>% | |
| filter(week == 1) %>% | |
| mutate(total_score = franchise_score + opponent_score) %>% | |
| left_join(ff_franchises(.x) %>% | |
| select(franchise_id,franchise_name), | |
| by = c('franchise_id')) %>% | |
| left_join(ff_franchises(.x) %>% | |
| select(opponent_id = franchise_id, opponent_name = franchise_name), | |
| by = c('opponent_id')) | |
| )) | |
| df <- sfb_leagues %>% | |
| select(matchups) %>% | |
| unnest(matchups) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment