#' Pull raw data for horse racing markets
#'
#' Pulls available horse race data for today
#'
#' @inheritParams login
#' @param save_address Folder address to save output (leave as NULL to return output to R)
#' @param filename File name (leave as NULL to name with default template)
#' @param maxResults Maximum number of results to return
#' @param ... Additional filters to api_filter
#'
#' @return Events data frame
#' @export
pull_raw_data <- function(username, password, api_token,
save_address = NULL,
filename = NULL,
maxResults = 1000,
...){
bf <- login(username, password, api_token)
c <- catalogue(bf,
maxResults = maxResults,
...)
if(!is.null(save_address)){
stopifnot(dir.exists(save_address))
if(is.null(filename)){
d <- format(Sys.Date(), format = "%d_%m_%y")
filename <- paste0(save_address, "/horse_data_", d, ".csv")
}
utils::write.csv(c, filename, row.names = FALSE)
} else {
return(c)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.