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(tidyverse) | |
library(httr) | |
library(jsonlite) | |
nflcom_authres <- httr::POST( | |
url = "https://api.nfl.com/v1/reroute", | |
body = list( | |
'grant_type' = 'client_credentials' | |
), | |
add_headers( |
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
ld <- read.csv("Data/leaguedata.csv") | |
ld$index <- 1:nrow(ld) | |
ld2 <- ld |> | |
dplyr::relocate(index,.before = "LeagueID") |> | |
dplyr::group_by(LeagueID) |> | |
dplyr::mutate( | |
W1.rank = dplyr::case_when(rank(W1.score)>=7~0,TRUE ~ 1), | |
W2.rank = dplyr::case_when(rank(W2.score)>=7~0,TRUE ~ 1), | |
W3.rank = dplyr::case_when(rank(W3.score)>=7~0,TRUE ~ 1), |
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(tidyverse) | |
library(googledrive) | |
library(googlesheets4) | |
library(janitor) | |
library(purrr) | |
googledrive::drive_auth() | |
googlesheets4::gs4_auth(token = googledrive::drive_token()) | |
get_adp_data <- function(year=2022){ |
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
suppressPackageStartupMessages(library(tidyverse)) # Data "Cleaning", "manipulation", "summarization", plotting | |
library(jsonlite, warn.conflicts=FALSE) # To Parse Json | |
library(janitor) # To clean after | |
dk_getprops <-function(leaguetype,bettype) { | |
sportid <- dplyr::case_when( | |
magrittr::equals(leaguetype, "cfb") ~ "87637", | |
magrittr::equals(leaguetype, "nfl") ~ "88808", | |
TRUE ~ "NA" |
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
data_rosters <- nflreadr::load_rosters(2006:2021) %>% | |
mutate(rosters_club = case_when( | |
draft_club == "ARZ" ~ "ARI", | |
draft_club == "BLT" ~ "BAL", | |
draft_club == "CLV" ~ "CLE", | |
draft_club == "HST" ~ "HOU", | |
draft_club == "OAK" ~ "LV", | |
draft_club == "LA" ~ "LAR", | |
draft_club == "SL" ~ "LAR", | |
draft_club == "STL" ~ "LAR", |
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
# Based on the work from Ben here: https://github.com/guga31bb/nfl_data_pipeline/tree/master/pff | |
# YOU NEED A PFF ELITE ACCOUNT FOR THIS | |
# after several downloads you may be logged out of your pff account, log in again and change to the new cookie. | |
suppressPackageStartupMessages(library(tidyverse)) # Data "Cleaning", "manipulation", "summarization", plotting | |
library(jsonlite, warn.conflicts=FALSE) # To Parse Json | |
library(httr) # To manage downloads | |
# In the browser Dev tools, check the headers of any json query in the premium stats PFF tool and put content of the header names "COOKIE" here | |
pff_cookie = 'XXXXXXXXX' #Change for correct cookie |
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
while read x; do | |
echo -n `date +%b\ %d\ %H:%M:%S` | |
echo " "$x | |
done |