#' @title Getting Odds for Final Week
#'
#' @description This function retrieves a csv file with odds data for the final week of matches in the Premier League.
#' @param url_value A character string for the URL on Dropbox of the csv file that stores this odds data.
#' @keywords import
#' @export
#' @examples
#' \dontrun{
#' get_odds_data(url_value = "https://www.abcdef.com/abcdefg123.csv")
#' }
get_odds_data <- function(url_value){
myConnection <- url(
paste0(url_value, "?raw=1")
)
data_read <- readr::read_csv(myConnection)
data_read %>%
tidyr::separate(
col = game,
into = c("homeTeam", "awayTeam"),
sep = "-",
remove = FALSE) %>%
dplyr::rowwise() %>%
dplyr::mutate(
overround = (1/homeValue) + (1/drawValue) + (1/awayValue),
homeLikelihood = 1/(homeValue * overround),
drawLikelihood = 1/(drawValue * overround),
awayLikelihood = 1/(awayValue * overround),
winSlice = homeLikelihood,
drawSlice = homeLikelihood + drawLikelihood
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.