R/update_league_history.R

Defines functions update_league_history

update_league_history <- function(filename){

  if(file.exists(filename)){
    data <- readr::read_csv(filename)

  if(get_current_gw() > max(data$gw)){
    new_data <- get_league_history(unique(data$league_id), get_current_gw())
    readr::write_csv(new_data, filename, append = TRUE)
  }else{
    stop("File Not Found")
    }
  }
}
tjconstant/ffs.query documentation built on May 25, 2019, 7:23 p.m.