๐
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
| json_list <- readRDS(url("https://github.com/guga31bb/sport_radar/blob/master/data/participation/c2b24b1a-98c5-465c-8f83-b82e746b4fcf.rds?raw=true")) | |
| plays <- json_list %>% | |
| list() %>% | |
| map(`[`,c("summary","plays")) %>% | |
| tibble() %>% | |
| unnest_wider(1) %>% | |
| hoist('summary','season','week') %>% | |
| mutate( | |
| season = map_dbl(season,pluck,"year"), |
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") %>% |
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
| observeEvent(input$run_main, { | |
| showModal(modalDialog(title = "Please wait", "Loading Data!")) | |
| df_reactivevalues <- tryCatch( | |
| fn_loaddata(df_reactivevalues), | |
| error = function(e) { | |
| Sys.sleep(2) | |
| showModal(modalDialog(title = "Oh no, we've found an error!", e$message))}, | |
| warning = function(e) { |
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(rvest) | |
| library(tidyverse) | |
| library(glue) | |
| library(ratelimitr) | |
| library(DBI) | |
| # Ratelimit read_html to 100 pages per minute | |
| lim_readhtml<-limit_rate(read_html,rate(n = 100,period = 60)) | |
| # Set parameters of loop |
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
| #### Convert bookdown to epub #### | |
| library(devtools) | |
| ## Clone to folder | |
| book_repo <- "hadley/adv-r" | |
| dest_folder <- "~/documents/github" |
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
| #### Snippet where I write csv files to https://github.com/DynastyProcess/data each week #### | |
| write.csv(values_players,'../data/files/values-players.csv',row.names = FALSE) | |
| write.csv(values_picks,'../data/files/values-picks.csv',row.names = FALSE) | |
| write.csv(values,'../data/files/values.csv',row.names = FALSE) | |
| write.csv(dp_playerids,'../data/files/db_playerids.csv',row.names = FALSE) | |
| data_repo <- git2r::repository('../data') # Set up connection to repository folder | |
| git2r::add(data_repo,'files/value*') # add specific files to staging of commit | |
| git2r::add(data_repo,'files/db_*') |
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
| # I struggled with uploading things to Microsoft Graph API/Sharepoint/OneDrive for business | |
| # here's the code that finally worked for me. | |
| library(AzureGraph) | |
| library(httr) | |
| # Creates authentication token via browser | |
| graph_token <- AzureGraph::create_graph_login()$token | |
| # Send a PUT request to the Microsoft Graph API |
NewerOlder